add "forge normal" to reset things to default development state
This commit is contained in:
parent
a21c117e5b
commit
9bcf2d968c
1
argv.go
1
argv.go
|
@ -23,6 +23,7 @@ type args struct {
|
||||||
Dirty *DirtyCmd `arg:"subcommand:dirty" help:"show dirty git repos"`
|
Dirty *DirtyCmd `arg:"subcommand:dirty" help:"show dirty git repos"`
|
||||||
GitFetch *FindCmd `arg:"subcommand:fetch" help:"run 'git fetch master'"`
|
GitFetch *FindCmd `arg:"subcommand:fetch" help:"run 'git fetch master'"`
|
||||||
List *FindCmd `arg:"subcommand:list" help:"print a table of the current repos"`
|
List *FindCmd `arg:"subcommand:list" help:"print a table of the current repos"`
|
||||||
|
Normal *EmptyCmd `arg:"subcommand:normal" help:"set every repo to the default state for software development"`
|
||||||
Merge *MergeCmd `arg:"subcommand:merge" help:"merge branches"`
|
Merge *MergeCmd `arg:"subcommand:merge" help:"merge branches"`
|
||||||
Patch *PatchCmd `arg:"subcommand:patch" help:"make patchsets"`
|
Patch *PatchCmd `arg:"subcommand:patch" help:"make patchsets"`
|
||||||
Pull *PullCmd `arg:"subcommand:pull" help:"run 'git pull'"`
|
Pull *PullCmd `arg:"subcommand:pull" help:"run 'git pull'"`
|
||||||
|
|
|
@ -66,7 +66,7 @@ func (args) doBashAuto() {
|
||||||
default:
|
default:
|
||||||
if argv.BashAuto[0] == ARGNAME {
|
if argv.BashAuto[0] == ARGNAME {
|
||||||
// list the subcommands here
|
// list the subcommands here
|
||||||
fmt.Println("--bash list checkout clean commit dirty debug fetch merge patch pull")
|
fmt.Println("--bash list checkout clean commit dirty debug fetch normal merge patch pull")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
|
22
doDirty.go
22
doDirty.go
|
@ -13,12 +13,7 @@ import (
|
||||||
|
|
||||||
func doDirty() {
|
func doDirty() {
|
||||||
doCheckDirtyAndConfigSave()
|
doCheckDirtyAndConfigSave()
|
||||||
if allerr := me.forge.RillRepos(checkNormalRepoState); len(allerr) != 0 {
|
|
||||||
log.Info("Some repos are not in a 'normal' state. error count =", len(allerr))
|
|
||||||
for repo, err := range allerr {
|
|
||||||
log.Info("repo not normal", repo.GetFullPath(), err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
found := findDirty()
|
found := findDirty()
|
||||||
if found.Len() == 0 {
|
if found.Len() == 0 {
|
||||||
return
|
return
|
||||||
|
@ -30,21 +25,6 @@ func doDirty() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 99% of the time, the repos during development should be on your user branch.
|
|
||||||
// error out if it's not
|
|
||||||
// this checks to see if a devel and user branch exist
|
|
||||||
// this needs to run each time in case repos were added manually by the user
|
|
||||||
// this also verifies that
|
|
||||||
func checkNormalRepoState(repo *gitpb.Repo) error {
|
|
||||||
if _, err := repo.MakeLocalDevelBranch(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
|
|
||||||
return repo.CheckoutUser()
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func straightCheckDirty() int {
|
func straightCheckDirty() int {
|
||||||
var count int
|
var count int
|
||||||
// var total int
|
// var total int
|
||||||
|
|
9
doGui.go
9
doGui.go
|
@ -167,6 +167,15 @@ func drawWindow(win *gadgets.GenericWindow) {
|
||||||
patchesWin = makePatchesWin(notdone)
|
patchesWin = makePatchesWin(notdone)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var pubWin *gadgets.GenericWindow
|
||||||
|
gridM.NewButton("Publish", func() {
|
||||||
|
if pubWin != nil {
|
||||||
|
pubWin.Toggle()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
pubWin = makePublishWindow()
|
||||||
|
})
|
||||||
|
|
||||||
var oldWin *gadgets.GenericWindow
|
var oldWin *gadgets.GenericWindow
|
||||||
gridM.NewButton("old", func() {
|
gridM.NewButton("old", func() {
|
||||||
if oldWin != nil {
|
if oldWin != nil {
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
||||||
|
// Use of this source code is governed by the GPL 3.0
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
// checks that repos are in a "normal" state
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func doNormal() bool {
|
||||||
|
if allerr := me.forge.RillRepos(checkNormalRepoState); len(allerr) != 0 {
|
||||||
|
log.Info("Some repos are not in a 'normal' state. error count =", len(allerr))
|
||||||
|
for repo, err := range allerr {
|
||||||
|
log.Info("repo not normal", repo.GetFullPath(), err)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 99% of the time, the repos during development should be on your user branch.
|
||||||
|
// error out if it's not
|
||||||
|
// this checks to see if a devel and user branch exist
|
||||||
|
// this needs to run each time in case repos were added manually by the user
|
||||||
|
// this also verifies that
|
||||||
|
func checkNormalRepoState(repo *gitpb.Repo) error {
|
||||||
|
if _, err := repo.MakeLocalDevelBranch(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
|
||||||
|
return repo.CheckoutUser()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
5
main.go
5
main.go
|
@ -129,6 +129,11 @@ func main() {
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if argv.Normal != nil {
|
||||||
|
doNormal()
|
||||||
|
okExit("")
|
||||||
|
}
|
||||||
|
|
||||||
if argv.Dirty != nil {
|
if argv.Dirty != nil {
|
||||||
doDirty()
|
doDirty()
|
||||||
okExit("")
|
okExit("")
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
||||||
|
// Use of this source code is governed by the GPL 3.0
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
// An app to submit patches for the 30 GO GUI repos
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.wit.com/lib/gadgets"
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Publish Window
|
||||||
|
func makePublishWindow() *gadgets.GenericWindow {
|
||||||
|
pubWin := gadgets.NewGenericWindow("publish code", "tasks for merging, versioning and publishing code")
|
||||||
|
|
||||||
|
grid := pubWin.Group.RawGrid()
|
||||||
|
|
||||||
|
grid.NewButton("merge all patches to master", func() {
|
||||||
|
pubWin.Disable()
|
||||||
|
defer pubWin.Enable()
|
||||||
|
|
||||||
|
if err := doAllCheckoutDevel(); err != nil {
|
||||||
|
log.Info("checkout error:", err)
|
||||||
|
} else {
|
||||||
|
log.Info("checkout was ok")
|
||||||
|
}
|
||||||
|
|
||||||
|
mergeUserToDevel(true)
|
||||||
|
|
||||||
|
if err := doAllCheckoutMaster(); err != nil {
|
||||||
|
log.Info("checkout error:", err)
|
||||||
|
} else {
|
||||||
|
log.Info("checkout was ok")
|
||||||
|
}
|
||||||
|
|
||||||
|
mergeDevelToMaster(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
return pubWin
|
||||||
|
}
|
Loading…
Reference in New Issue