diff --git a/Makefile b/Makefile index 9cbc461..70655a7 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,9 @@ info: @echo "make all # show all repos" @echo "make pull # run git pull on every repo" @echo "make dirty # CheckDirty()" + @echo "make user # git checkout user" + @echo "make master # git checkout master" + forge --do-gui vet: @GO111MODULE=off go vet @@ -86,3 +89,9 @@ restart: reset -rm ~/go/src/repos.pb make private + +user: install + forge --user + +master: install + forge --master diff --git a/argv.go b/argv.go index 3c7c2ba..ba8f334 100644 --- a/argv.go +++ b/argv.go @@ -30,6 +30,8 @@ type args struct { URL string `arg:"--url" default:"http://go.wit.com/" help:"base url"` Delete string `arg:"--delete" help:"delete this repo"` Dirty bool `arg:"--dirty" help:"git CheckDirty() on every repo"` + User bool `arg:"--user" help:"git checkout user"` + Master bool `arg:"--master" help:"git checkout master"` } func (args) Version() string { diff --git a/doGui.go b/doGui.go index b412df5..3a07511 100644 --- a/doGui.go +++ b/doGui.go @@ -12,7 +12,7 @@ func doGui() { me.myGui = gui.New() me.myGui.Default() - me.mainWindow = gadgets.RawBasicWindow("submit & test patchsets") + me.mainWindow = gadgets.RawBasicWindow("Forge: use this to submit patches") me.mainWindow.Make() me.mainWindow.Show() me.mainbox = me.mainWindow.Box() @@ -28,12 +28,13 @@ func doGui() { // processing is done. update the repo summary box me.summary.Update() + me.summary.submitB.Disable() me.Enable() // intermittently scans the status indefinitly me.repos.View.Watchdog(func() { - log.Info("In main()") + log.Info("Watchdog in doGui()") // processing is done. update the repo summary box me.summary.Update() }) diff --git a/globalBuildOptions.go b/globalBuildOptions.go index 8f49e7c..5f7a71b 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -46,7 +46,7 @@ func quickCmd(fullpath string, cmd []string) bool { } func globalBuildOptions(vbox *gui.Node) { - group1 := vbox.NewGroup("Global Build Options") + group1 := vbox.NewGroup("Forge Settings") grid := group1.NewGrid("buildOptions", 0, 0) // me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)") diff --git a/main.go b/main.go index 562565d..2bf1e9c 100644 --- a/main.go +++ b/main.go @@ -4,8 +4,10 @@ package main import ( "strings" + "time" "go.wit.com/dev/alexflint/arg" + "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/forgepb" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" @@ -42,6 +44,16 @@ func main() { configSave = false } + if argv.User { + me.forge.CheckoutUser() + okExit("") + } + + if argv.Master { + me.forge.CheckoutMaster() + okExit("") + } + if argv.Delete != "" { me.forge.DeleteByGoPath(argv.Delete) me.forge.SetConfigSave(true) @@ -49,6 +61,7 @@ func main() { } if argv.Dirty { + now := time.Now() all := me.forge.Repos.SortByFullPath() for all.Scan() { repo := all.Next() @@ -65,6 +78,7 @@ func main() { } } doCobol() + log.Info("dirty check took:", shell.FormatDuration(time.Since(now))) me.forge.SetConfigSave(configSave) okExit("") } diff --git a/subitPatches.go b/subitPatches.go index 6844297..a653bcf 100644 --- a/subitPatches.go +++ b/subitPatches.go @@ -30,8 +30,8 @@ type patchSummary struct { checkB *gui.Node // stats - totalOL *gadgets.OneLiner - totalGoOL *gadgets.OneLiner + totalOL *gadgets.OneLiner + // totalGoOL *gadgets.OneLiner dirtyOL *gadgets.OneLiner readonlyOL *gadgets.OneLiner totalPatchesOL *gadgets.OneLiner @@ -52,44 +52,47 @@ type patchSummary struct { func submitPatchesBox(box *gui.Node) *patchSummary { s := new(patchSummary) - group1 := box.NewGroup("Submit Patches Summary") + group1 := box.NewGroup("Patch Summary") s.grid = group1.RawGrid() s.grid.NewButton("Update Patch Counts", func() { - var repocount, patchcount int - // broken after move to forge protobuf - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() - if repo.GetReadOnly() { - continue + /* + var repocount, patchcount int + // broken after move to forge protobuf + all := me.forge.Repos.SortByFullPath() + for all.Scan() { + repo := all.Next() + if repo.GetReadOnly() { + continue + } + i, _ := repo.GetMasterPatches() + patchcount += i + if i > 0 { + repocount += 1 + } } - i, _ := repo.GetMasterPatches() - patchcount += i - if i > 0 { - repocount += 1 - } - } - s.totalMasterPatches.SetText(strconv.Itoa(patchcount) + " patches") - s.totalMasterRepos.SetText(strconv.Itoa(repocount) + " go repos") + s.totalMasterPatches.SetText(strconv.Itoa(patchcount) + " patches") + s.totalMasterRepos.SetText(strconv.Itoa(repocount) + " go repos") - repocount = 0 - patchcount = 0 - // broken after move to forge protobuf - all = me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() - if repo.GetReadOnly() { - continue + repocount = 0 + patchcount = 0 + // broken after move to forge protobuf + all = me.forge.Repos.SortByFullPath() + for all.Scan() { + repo := all.Next() + if repo.GetReadOnly() { + continue + } + i, _ := repo.GetUserPatches() + patchcount += i + if i > 0 { + repocount += 1 + } } - i, _ := repo.GetUserPatches() - patchcount += i - if i > 0 { - repocount += 1 - } - } - s.totalUserPatches.SetText(strconv.Itoa(patchcount) + " patches") - s.totalUserRepos.SetText(strconv.Itoa(repocount) + " go repos") + s.totalUserPatches.SetText(strconv.Itoa(patchcount) + " patches") + s.totalUserRepos.SetText(strconv.Itoa(repocount) + " go repos") + */ + s.Update() }) /* this used to be the way and should probably be revisited @@ -105,8 +108,8 @@ func submitPatchesBox(box *gui.Node) *patchSummary { s.totalOL = gadgets.NewOneLiner(s.grid, "Total") s.grid.NextRow() - s.totalGoOL = gadgets.NewOneLiner(s.grid, "Total GO") - s.grid.NextRow() + // s.totalGoOL = gadgets.NewOneLiner(s.grid, "Total GO") + // s.grid.NextRow() s.dirtyOL = gadgets.NewOneLiner(s.grid, "dirty") s.grid.NextRow() @@ -145,9 +148,9 @@ func submitPatchesBox(box *gui.Node) *patchSummary { }) s.grid.NextRow() - group1 = box.NewGroup("Create GUI Patch Set") + group1 = box.NewGroup("Submit Patch Set") s.grid = group1.RawGrid() - s.reason = gadgets.NewBasicEntry(s.grid, "patch name:") + s.reason = gadgets.NewBasicEntry(s.grid, "set name:") s.reason.Custom = func() { if s.reason.String() != "" { s.submitB.Enable() @@ -155,7 +158,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary { s.submitB.Disable() } } - s.submitB = s.grid.NewButton("Create Patch Set", func() { + s.submitB = s.grid.NewButton("Submit", func() { dirname := "submit-patchset.quilt" patchdir := filepath.Join(me.userHomePwd.String(), dirname) if shell.Exists(patchdir) { @@ -169,11 +172,13 @@ func submitPatchesBox(box *gui.Node) *patchSummary { } me.repos.View.MakePatchset(patchdir) }) - s.submitB = s.grid.NewButton("Submit quilt", func() { - log.Info("do a submit here") - }) + /* + s.submitB = s.grid.NewButton("Submit quilt", func() { + log.Info("do a submit here") + }) + */ // disable these until there are not dirty repos - s.reason.Disable() + // s.reason.Disable() s.submitB.Disable() s.grid.NextRow() @@ -186,7 +191,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary { // does not run any commands func (s *patchSummary) Update() { - var total, totalgo, dirty, readonly int + var total, dirty, readonly int var userT, develT, masterT int // var userP, develP, masterP int // broken after move to forge protobuf @@ -219,7 +224,7 @@ func (s *patchSummary) Update() { } } s.totalOL.SetText(strconv.Itoa(total) + " repos") - s.totalGoOL.SetText(strconv.Itoa(totalgo) + " repos") + // s.totalGoOL.SetText(strconv.Itoa(totalgo) + " repos") s.dirtyOL.SetText(strconv.Itoa(dirty) + " repos") s.readonlyOL.SetText(strconv.Itoa(readonly) + " repos") @@ -233,7 +238,7 @@ func (s *patchSummary) Update() { // s.unknownOL.Enable() // s.unknownSubmitB.Enable() } else { - s.reason.Disable() + // s.reason.Disable() s.submitB.Enable() // s.unknownOL.Enable() // s.unknownSubmitB.Enable()