From b7a6001ba450de82e1aa216410f236f516f50a17 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 23 Dec 2024 03:45:30 -0600 Subject: submit sends patches --- Makefile | 2 +- repoview.go | 202 ------------------------------------------- structs.go | 6 +- subitPatches.go | 256 ------------------------------------------------------- windowPatches.go | 256 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ windowRepos.go | 202 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 462 insertions(+), 462 deletions(-) delete mode 100644 repoview.go delete mode 100644 subitPatches.go create mode 100644 windowPatches.go create mode 100644 windowRepos.go diff --git a/Makefile b/Makefile index 70655a7..7148a01 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ goimports: @# // gofmt -w -r '"go.wit.com/gui/gadgets" -> "go.wit.com/lib/gadgets"' *.go gocui: install - forge --gui gocui + forge --gui gocui --do-gui redomod-all: forge --do-RedoGoMod diff --git a/repoview.go b/repoview.go deleted file mode 100644 index 736ba15..0000000 --- a/repoview.go +++ /dev/null @@ -1,202 +0,0 @@ -package main - -import ( - "go.wit.com/lib/gadgets" - "go.wit.com/lib/gui/repolist" - "go.wit.com/log" - - "go.wit.com/gui" -) - -type repoWindow struct { - win *gadgets.BasicWindow - box *gui.Node - - // the top box of the repolist window - topbox *gui.Node - - View *repolist.RepoList -} - -func (r *repoWindow) Hidden() bool { - return r.win.Hidden() -} - -func (r *repoWindow) Show() { - r.win.Show() -} - -func (r *repoWindow) Hide() { - r.win.Hide() -} - -func (r *repoWindow) Disable() { - r.box.Disable() -} - -func (r *repoWindow) Enable() { - r.box.Enable() -} - -// you can only have one of these -func makeRepoView() *repoWindow { - if me.repos != nil { - return me.repos - } - r := new(repoWindow) - r.win = gadgets.RawBasicWindow("All git repositories in ~/go/src/") - r.win.Make() - - r.box = r.win.Box().NewBox("bw vbox", false) - // me.reposwin.Draw() - r.win.Custom = func() { - log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close") - log.Warn("Should I do something special here?") - } - - r.topbox = r.repoMenu() - - r.View = repolist.InitBox(me.forge, r.box) - r.View.Enable() - - r.View.ScanRepositories() - - /* - r.View = repolist.AutotypistView(r.box) - - showncount := r.View.MirrorShownCount() - r.topbox.Append(showncount) - duration := r.View.MirrorScanDuration() - r.topbox.Append(duration) - */ - return r -} - -func (r *repoWindow) repoMenu() *gui.Node { - // reposbox.SetExpand(false) - group1 := r.box.NewGroup("Run on all repos:") - - hbox := group1.Box() - // hbox.Horizontal() - hbox.Vertical() - - box2 := hbox.Box().Vertical() - /* - box2.NewButton("merge all user to devel", func() { - r.Disable() - if !r.mergeAllUserToDevel() { - return - } - r.Enable() - }) - - box2.NewButton("merge all devel to main", func() { - r.Disable() - if !r.mergeAllDevelToMain() { - return - } - r.Enable() - }) - */ - - box2.NewButton("merge it all", func() { - r.Disable() - if !r.mergeAllUserToDevel() { - return - } - if !r.mergeAllDevelToMain() { - return - } - r.Enable() - }) - - box2.NewButton("show apps", func() { - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - rtype := repo.Status.RepoType() - switch rtype { - case "'binary'": - // log.Info(repo.Status.Path(), "compile here. Show()") - repo.Show() - case "'library'": - // log.Info(repo.Status.Path(), "library here. Hide()") - repo.Hide() - default: - log.Info(repo.Status.Path(), "unknown type", rtype) - // repo.Hide() - } - } - }) - box2.NewButton("scan now", func() { - log.Info("re-scanning now") - i, s := me.repos.View.ScanRepositories() - log.Info("re-scanning done", i, "repos in", s) - }) - - return box2 -} - -func (r *repoWindow) mergeAllDevelToMain() bool { - log.Info("merge all here") - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - if repo.ReadOnly() { - log.Info("skipping readonly", repo.Name(), repo.State()) - continue - } - if repo.State() != "merge to main" { - log.Info("skipping. not merge to main", repo.Name(), repo.State()) - continue - } - if repo.CheckDirty() { - log.Info("skipping dirty", repo.Name(), repo.State()) - continue - } - log.Info("repo:", repo.Name(), repo.State()) - repo.NewScan() - if repo.Status.MergeDevelToMaster() { - log.Warn("THINGS SEEM OK fullAutomation() returned true.") - } else { - log.Warn("last repo:", repo.Name()) - log.Warn("THINGS FAILED fullAutomation() returned false") - return false - } - repo.NewScan() - } - log.Warn("EVERYTHING WORKED") - return true -} - -func (r *repoWindow) mergeAllUserToDevel() bool { - log.Info("merge all here") - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - if repo.ReadOnly() { - log.Info("skipping readonly", repo.Name(), repo.State()) - continue - } - if repo.State() != "merge to devel" { - log.Info("skipping. not merge to devel", repo.Name(), repo.State()) - continue - } - if repo.CheckDirty() { - log.Info("skipping dirty", repo.Name(), repo.State()) - continue - } - log.Info("repo:", repo.Name(), repo.State()) - repo.NewScan() - if repo.Status.MergeUserToDevel() { - log.Warn("THINGS SEEM OK fullAutomation() returned true.") - } else { - log.Warn("last repo:", repo.Status.Path()) - log.Warn("THINGS FAILED fullAutomation() returned false") - return false - } - repo.NewScan() - } - log.Warn("EVERYTHING WORKED") - return true -} diff --git a/structs.go b/structs.go index 3f55b3d..b5f5ee0 100644 --- a/structs.go +++ b/structs.go @@ -37,11 +37,11 @@ type mainType struct { mainbox *gui.Node // the window from the /lib/gui/gowit package - lw *gadgets.BasicWindow + // lw *gadgets.BasicWindow // #### Sorting options for the repolist - autoHidePerfect *gui.Node - autoHideReadOnly *gui.Node + // autoHidePerfect *gui.Node + // autoHideReadOnly *gui.Node // checkbox for --dry-run autoDryRun *gui.Node diff --git a/subitPatches.go b/subitPatches.go deleted file mode 100644 index 9929909..0000000 --- a/subitPatches.go +++ /dev/null @@ -1,256 +0,0 @@ -package main - -import ( - "os" - "path/filepath" - "strconv" - - "go.wit.com/gui" - "go.wit.com/lib/gadgets" - "go.wit.com/lib/gui/repolist" - "go.wit.com/lib/gui/shell" - "go.wit.com/log" -) - -/* -type patch struct { - ref string - giturl string - comment string - rs *repostatus.RepoStatus -} -*/ - -type patchSummary struct { - grid *gui.Node - updateB *gui.Node - docsB *gui.Node - gitPushB *gui.Node - gitPullB *gui.Node - checkB *gui.Node - - // stats - totalOL *gadgets.OneLiner - // totalGoOL *gadgets.OneLiner - dirtyOL *gadgets.OneLiner - readonlyOL *gadgets.OneLiner - totalPatchesOL *gadgets.OneLiner - totalUserRepos *gui.Node - totalDevelRepos *gui.Node - totalMasterRepos *gui.Node - totalUserPatches *gui.Node - totalDevelPatches *gui.Node - totalMasterPatches *gui.Node - - // patch set generation - unknownOL *gadgets.BasicEntry - unknownSubmitB *gui.Node - reason *gadgets.BasicEntry - submitB *gui.Node - allp []*repolist.Patch -} - -func submitPatchesBox(box *gui.Node) *patchSummary { - s := new(patchSummary) - 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 - } - 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") - - 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 - } - } - s.totalUserPatches.SetText(strconv.Itoa(patchcount) + " patches") - s.totalUserRepos.SetText(strconv.Itoa(repocount) + " go repos") - }) - */ - - /* this used to be the way and should probably be revisited - s.grid.NewButton("Make Patches", func() { - for i, p := range s.allp { - log.Info(i, p.Ref, p.RS.String()) - } - }) - */ - - s.grid.NextRow() - - s.totalOL = gadgets.NewOneLiner(s.grid, "Total") - s.grid.NextRow() - - // s.totalGoOL = gadgets.NewOneLiner(s.grid, "Total GO") - // s.grid.NextRow() - - s.dirtyOL = gadgets.NewOneLiner(s.grid, "dirty") - s.grid.NextRow() - - s.readonlyOL = gadgets.NewOneLiner(s.grid, "read-only") - s.grid.NextRow() - - // s.grid = group1.RawGrid() - s.grid.NewLabel("") - s.grid.NewLabel("") - s.grid.NewLabel("user to devel") - s.grid.NewLabel("devel to master") - s.grid.NewLabel("master to last tag") - s.grid.NextRow() - - s.grid.NewLabel("total modified") - s.grid.NewLabel("") - s.totalUserRepos = s.grid.NewLabel("x go repos") - s.totalDevelRepos = s.grid.NewLabel("") - s.totalMasterRepos = s.grid.NewLabel("x go repos") - s.grid.NextRow() - - s.totalPatchesOL = gadgets.NewOneLiner(s.grid, "total commits") - s.totalUserPatches = s.grid.NewLabel("x patches") - s.totalDevelPatches = s.grid.NewLabel("") - s.totalMasterPatches = s.grid.NewLabel("x patches") - s.grid.NextRow() - - /* - s.grid.NewLabel("") - s.grid.NewLabel("") - s.grid.NewButton("merge from user", func() { - log.Info("this should make a patchset of your patches") - }) - s.grid.NewButton("merge from devel", func() { - log.Info("this probably should not exist") - }) - */ - s.grid.NextRow() - - group1 = box.NewGroup("Submit Patch Set") - s.grid = group1.RawGrid() - s.reason = gadgets.NewBasicEntry(s.grid, "set name:") - s.reason.Custom = func() { - if s.reason.String() != "" { - s.submitB.Enable() - } else { - s.submitB.Disable() - } - } - s.submitB = s.grid.NewButton("Submit", func() { - dirname := "submit-patchset.quilt" - patchdir := filepath.Join(me.userHomePwd.String(), dirname) - if shell.Exists(patchdir) { - log.Info("patchset dir already exists", patchdir) - shell.PathRun(me.userHomePwd.String(), []string{"rm", "-rf", dirname}) - } - os.MkdirAll(patchdir, os.ModeDir) - if !shell.Exists(patchdir) { - log.Info("something went wrong making", patchdir) - return - } - me.repos.View.MakePatchset(patchdir) - }) - s.grid.NewButton("Show Repos", func() { - s.Update() - if me.repos.Hidden() { - me.repos.Show() - } else { - me.repos.Hide() - } - }) - - /* - 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.submitB.Disable() - s.grid.NextRow() - - // s.unknownOL.Disable() - // s.unknownSubmitB.Disable() - s.grid.NextRow() - - return s -} - -// does not run any commands -func (s *patchSummary) Update() { - var total, dirty, readonly int - var userT, develT, masterT int - // var userP, develP, masterP int - // broken after move to forge protobuf - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() - total += 1 - if repo.IsDirty() { - dirty += 1 - } - if repo.GetReadOnly() { - readonly += 1 - // don't count these in any further stats - continue - } - // compute which GUI repos are out of sync with master - userV := repo.GetUserVersion() - develV := repo.GetDevelVersion() - masterV := repo.GetMasterVersion() - lastV := repo.GetLastTagVersion() - if userV != develV { - userT += 1 - } - if develV != masterV { - log.Info("develV != masterV", develV, masterV, repo.GetGoPath()) - develT += 1 - } - if masterV != lastV { - masterT += 1 - } - } - s.totalOL.SetText(strconv.Itoa(total) + " repos") - // s.totalGoOL.SetText(strconv.Itoa(totalgo) + " repos") - s.dirtyOL.SetText(strconv.Itoa(dirty) + " repos") - s.readonlyOL.SetText(strconv.Itoa(readonly) + " repos") - - s.totalUserRepos.SetText(strconv.Itoa(userT) + " repos") - s.totalDevelRepos.SetText(strconv.Itoa(develT) + " repos") - s.totalMasterRepos.SetText(strconv.Itoa(masterT) + " repos") - - if dirty == 0 { - s.reason.Enable() - s.submitB.Enable() - // s.unknownOL.Enable() - // s.unknownSubmitB.Enable() - } else { - // s.reason.Disable() - s.submitB.Enable() - // s.unknownOL.Enable() - // s.unknownSubmitB.Enable() - } -} diff --git a/windowPatches.go b/windowPatches.go new file mode 100644 index 0000000..bd14797 --- /dev/null +++ b/windowPatches.go @@ -0,0 +1,256 @@ +package main + +import ( + "strconv" + + "go.wit.com/gui" + "go.wit.com/lib/gadgets" + "go.wit.com/lib/gui/repolist" + "go.wit.com/log" +) + +/* +type patch struct { + ref string + giturl string + comment string + rs *repostatus.RepoStatus +} +*/ + +type patchSummary struct { + grid *gui.Node + updateB *gui.Node + docsB *gui.Node + gitPushB *gui.Node + gitPullB *gui.Node + checkB *gui.Node + + // stats + totalOL *gadgets.OneLiner + // totalGoOL *gadgets.OneLiner + dirtyOL *gadgets.OneLiner + readonlyOL *gadgets.OneLiner + totalPatchesOL *gadgets.OneLiner + totalUserRepos *gui.Node + totalDevelRepos *gui.Node + totalMasterRepos *gui.Node + totalUserPatches *gui.Node + totalDevelPatches *gui.Node + totalMasterPatches *gui.Node + + // patch set generation + unknownOL *gadgets.BasicEntry + unknownSubmitB *gui.Node + reason *gadgets.BasicEntry + submitB *gui.Node + allp []*repolist.Patch +} + +func submitPatchesBox(box *gui.Node) *patchSummary { + s := new(patchSummary) + 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 + } + 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") + + 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 + } + } + s.totalUserPatches.SetText(strconv.Itoa(patchcount) + " patches") + s.totalUserRepos.SetText(strconv.Itoa(repocount) + " go repos") + }) + */ + + /* this used to be the way and should probably be revisited + s.grid.NewButton("Make Patches", func() { + for i, p := range s.allp { + log.Info(i, p.Ref, p.RS.String()) + } + }) + */ + + s.grid.NextRow() + + s.totalOL = gadgets.NewOneLiner(s.grid, "Total") + s.grid.NextRow() + + // s.totalGoOL = gadgets.NewOneLiner(s.grid, "Total GO") + // s.grid.NextRow() + + s.dirtyOL = gadgets.NewOneLiner(s.grid, "dirty") + s.grid.NextRow() + + s.readonlyOL = gadgets.NewOneLiner(s.grid, "read-only") + s.grid.NextRow() + + // s.grid = group1.RawGrid() + s.grid.NewLabel("") + s.grid.NewLabel("") + s.grid.NewLabel("user to devel") + s.grid.NewLabel("devel to master") + s.grid.NewLabel("master to last tag") + s.grid.NextRow() + + s.grid.NewLabel("total modified") + s.grid.NewLabel("") + s.totalUserRepos = s.grid.NewLabel("x go repos") + s.totalDevelRepos = s.grid.NewLabel("") + s.totalMasterRepos = s.grid.NewLabel("x go repos") + s.grid.NextRow() + + s.totalPatchesOL = gadgets.NewOneLiner(s.grid, "total commits") + s.totalUserPatches = s.grid.NewLabel("x patches") + s.totalDevelPatches = s.grid.NewLabel("") + s.totalMasterPatches = s.grid.NewLabel("x patches") + s.grid.NextRow() + + /* + s.grid.NewLabel("") + s.grid.NewLabel("") + s.grid.NewButton("merge from user", func() { + log.Info("this should make a patchset of your patches") + }) + s.grid.NewButton("merge from devel", func() { + log.Info("this probably should not exist") + }) + */ + s.grid.NextRow() + + group1 = box.NewGroup("Submit Patch Set") + s.grid = group1.RawGrid() + s.reason = gadgets.NewBasicEntry(s.grid, "set name:") + s.reason.Custom = func() { + if s.reason.String() != "" { + s.submitB.Enable() + } else { + s.submitB.Disable() + } + } + s.submitB = s.grid.NewButton("Submit", func() { + sendDevelDiff() + /* + dirname := "submit-patchset.quilt" + patchdir := filepath.Join(me.userHomePwd.String(), dirname) + if shell.Exists(patchdir) { + log.Info("patchset dir already exists", patchdir) + shell.PathRun(me.userHomePwd.String(), []string{"rm", "-rf", dirname}) + } + os.MkdirAll(patchdir, os.ModeDir) + if !shell.Exists(patchdir) { + log.Info("something went wrong making", patchdir) + return + } + me.repos.View.MakePatchset(patchdir) + */ + }) + s.grid.NewButton("Show Repos", func() { + s.Update() + if me.repos.Hidden() { + me.repos.Show() + } else { + me.repos.Hide() + } + }) + + /* + 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.submitB.Disable() + s.grid.NextRow() + + // s.unknownOL.Disable() + // s.unknownSubmitB.Disable() + s.grid.NextRow() + + return s +} + +// does not run any commands +func (s *patchSummary) Update() { + var total, dirty, readonly int + var userT, develT, masterT int + // var userP, develP, masterP int + // broken after move to forge protobuf + all := me.forge.Repos.SortByFullPath() + for all.Scan() { + repo := all.Next() + total += 1 + if repo.IsDirty() { + dirty += 1 + } + if repo.GetReadOnly() { + readonly += 1 + // don't count these in any further stats + continue + } + // compute which GUI repos are out of sync with master + userV := repo.GetUserVersion() + develV := repo.GetDevelVersion() + masterV := repo.GetMasterVersion() + lastV := repo.GetLastTagVersion() + if userV != develV { + userT += 1 + } + if develV != masterV { + log.Info("develV != masterV", develV, masterV, repo.GetGoPath()) + develT += 1 + } + if masterV != lastV { + masterT += 1 + } + } + s.totalOL.SetText(strconv.Itoa(total) + " repos") + // s.totalGoOL.SetText(strconv.Itoa(totalgo) + " repos") + s.dirtyOL.SetText(strconv.Itoa(dirty) + " repos") + s.readonlyOL.SetText(strconv.Itoa(readonly) + " repos") + + s.totalUserRepos.SetText(strconv.Itoa(userT) + " repos") + s.totalDevelRepos.SetText(strconv.Itoa(develT) + " repos") + s.totalMasterRepos.SetText(strconv.Itoa(masterT) + " repos") + + if dirty == 0 { + s.reason.Enable() + s.submitB.Enable() + // s.unknownOL.Enable() + // s.unknownSubmitB.Enable() + } else { + // s.reason.Disable() + s.submitB.Enable() + // s.unknownOL.Enable() + // s.unknownSubmitB.Enable() + } +} diff --git a/windowRepos.go b/windowRepos.go new file mode 100644 index 0000000..736ba15 --- /dev/null +++ b/windowRepos.go @@ -0,0 +1,202 @@ +package main + +import ( + "go.wit.com/lib/gadgets" + "go.wit.com/lib/gui/repolist" + "go.wit.com/log" + + "go.wit.com/gui" +) + +type repoWindow struct { + win *gadgets.BasicWindow + box *gui.Node + + // the top box of the repolist window + topbox *gui.Node + + View *repolist.RepoList +} + +func (r *repoWindow) Hidden() bool { + return r.win.Hidden() +} + +func (r *repoWindow) Show() { + r.win.Show() +} + +func (r *repoWindow) Hide() { + r.win.Hide() +} + +func (r *repoWindow) Disable() { + r.box.Disable() +} + +func (r *repoWindow) Enable() { + r.box.Enable() +} + +// you can only have one of these +func makeRepoView() *repoWindow { + if me.repos != nil { + return me.repos + } + r := new(repoWindow) + r.win = gadgets.RawBasicWindow("All git repositories in ~/go/src/") + r.win.Make() + + r.box = r.win.Box().NewBox("bw vbox", false) + // me.reposwin.Draw() + r.win.Custom = func() { + log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close") + log.Warn("Should I do something special here?") + } + + r.topbox = r.repoMenu() + + r.View = repolist.InitBox(me.forge, r.box) + r.View.Enable() + + r.View.ScanRepositories() + + /* + r.View = repolist.AutotypistView(r.box) + + showncount := r.View.MirrorShownCount() + r.topbox.Append(showncount) + duration := r.View.MirrorScanDuration() + r.topbox.Append(duration) + */ + return r +} + +func (r *repoWindow) repoMenu() *gui.Node { + // reposbox.SetExpand(false) + group1 := r.box.NewGroup("Run on all repos:") + + hbox := group1.Box() + // hbox.Horizontal() + hbox.Vertical() + + box2 := hbox.Box().Vertical() + /* + box2.NewButton("merge all user to devel", func() { + r.Disable() + if !r.mergeAllUserToDevel() { + return + } + r.Enable() + }) + + box2.NewButton("merge all devel to main", func() { + r.Disable() + if !r.mergeAllDevelToMain() { + return + } + r.Enable() + }) + */ + + box2.NewButton("merge it all", func() { + r.Disable() + if !r.mergeAllUserToDevel() { + return + } + if !r.mergeAllDevelToMain() { + return + } + r.Enable() + }) + + box2.NewButton("show apps", func() { + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() + rtype := repo.Status.RepoType() + switch rtype { + case "'binary'": + // log.Info(repo.Status.Path(), "compile here. Show()") + repo.Show() + case "'library'": + // log.Info(repo.Status.Path(), "library here. Hide()") + repo.Hide() + default: + log.Info(repo.Status.Path(), "unknown type", rtype) + // repo.Hide() + } + } + }) + box2.NewButton("scan now", func() { + log.Info("re-scanning now") + i, s := me.repos.View.ScanRepositories() + log.Info("re-scanning done", i, "repos in", s) + }) + + return box2 +} + +func (r *repoWindow) mergeAllDevelToMain() bool { + log.Info("merge all here") + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() + if repo.ReadOnly() { + log.Info("skipping readonly", repo.Name(), repo.State()) + continue + } + if repo.State() != "merge to main" { + log.Info("skipping. not merge to main", repo.Name(), repo.State()) + continue + } + if repo.CheckDirty() { + log.Info("skipping dirty", repo.Name(), repo.State()) + continue + } + log.Info("repo:", repo.Name(), repo.State()) + repo.NewScan() + if repo.Status.MergeDevelToMaster() { + log.Warn("THINGS SEEM OK fullAutomation() returned true.") + } else { + log.Warn("last repo:", repo.Name()) + log.Warn("THINGS FAILED fullAutomation() returned false") + return false + } + repo.NewScan() + } + log.Warn("EVERYTHING WORKED") + return true +} + +func (r *repoWindow) mergeAllUserToDevel() bool { + log.Info("merge all here") + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() + if repo.ReadOnly() { + log.Info("skipping readonly", repo.Name(), repo.State()) + continue + } + if repo.State() != "merge to devel" { + log.Info("skipping. not merge to devel", repo.Name(), repo.State()) + continue + } + if repo.CheckDirty() { + log.Info("skipping dirty", repo.Name(), repo.State()) + continue + } + log.Info("repo:", repo.Name(), repo.State()) + repo.NewScan() + if repo.Status.MergeUserToDevel() { + log.Warn("THINGS SEEM OK fullAutomation() returned true.") + } else { + log.Warn("last repo:", repo.Status.Path()) + log.Warn("THINGS FAILED fullAutomation() returned false") + return false + } + repo.NewScan() + } + log.Warn("EVERYTHING WORKED") + return true +} -- cgit v1.2.3