From 7071aad1a59904b8328fbb23ac8aeb59b6a4addd Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 2 Feb 2024 15:22:48 -0600 Subject: [PATCH] add a do-it all button for merging Signed-off-by: Jeff Carr --- globalResetOptions.go | 2 +- repolist.go | 107 ++++++++++++++++++++++++++---------------- 2 files changed, 67 insertions(+), 42 deletions(-) diff --git a/globalResetOptions.go b/globalResetOptions.go index 4c7b626..1654c77 100644 --- a/globalResetOptions.go +++ b/globalResetOptions.go @@ -100,5 +100,5 @@ func attemptAutoRebuild() { quickCmd(fullpath, []string{"go", "build", "-v", "-x", "-buildmode=plugin", "-o", libfile}) fullpath = filepath.Join(homeDir, "go/src/go.wit.com") - quickCmd(fullpath, []string{"go", "install", "-v", "go.wit.com/apps/autotypist@"+version}) + quickCmd(fullpath, []string{"go", "install", "-v", "go.wit.com/apps/autotypist@" + version}) } diff --git a/repolist.go b/repolist.go index 34af776..0d6ffd6 100644 --- a/repolist.go +++ b/repolist.go @@ -201,6 +201,70 @@ func repoAllButtons(box *gui.Node) { grid1.NewButton("merge all user to devel", func() { reposwin.Disable() + if ! mergeAllUserToDevel() { + return + } + reposwin.Enable() + }) + + grid1.NewButton("merge all devel to main", func() { + reposwin.Disable() + if ! mergeAllDevelToMain() { + return + } + reposwin.Enable() + }) + + grid1.NewButton("merge it all", func() { + reposwin.Disable() + if ! mergeAllUserToDevel() { + return + } + if ! mergeAllDevelToMain() { + return + } + reposwin.Enable() + }) + + grid1.NewButton("status.Update() all", func() { + for _, repo := range me.allrepos { + repo.status.Update() + repo.newScan() + } + }) +} + +func mergeAllDevelToMain() bool { + log.Info("merge all here") + for _, repo := range me.allrepos { + if repo.status.ReadOnly() { + log.Info("skipping readonly", repo.String(), repo.dirtyLabel.String()) + continue + } + if repo.dirtyLabel.String() != "merge to main" { + log.Info("skipping. not merge to main", repo.String(), repo.dirtyLabel.String()) + continue + } + if repo.status.CheckDirty() { + log.Info("skipping dirty", repo.String(), repo.dirtyLabel.String()) + continue + } + log.Info("found", repo.String(), repo.dirtyLabel.String()) + // repo.status.Update() + if repo.status.RunDevelMergeB() { + log.Warn("THINGS SEEM OK fullAutomation() returned true.") + } else { + log.Warn("THINGS FAILED fullAutomation() returned false") + return false + } + repo.status.Update() + repo.newScan() + } + log.Warn("EVERYTHING WORKED") + return true +} + +func mergeAllUserToDevel() bool { log.Info("merge all here") for _, repo := range me.allrepos { if repo.status.ReadOnly() { @@ -221,50 +285,11 @@ func repoAllButtons(box *gui.Node) { log.Warn("THINGS SEEM OK fullAutomation() returned true.") } else { log.Warn("THINGS FAILED fullAutomation() returned false") - return + return false } repo.status.Update() repo.newScan() } log.Warn("EVERYTHING WORKED") - reposwin.Enable() - }) - - grid1.NewButton("merge all devel to main", func() { - reposwin.Disable() - log.Info("merge all here") - for _, repo := range me.allrepos { - if repo.status.ReadOnly() { - log.Info("skipping readonly", repo.String(), repo.dirtyLabel.String()) - continue - } - if repo.dirtyLabel.String() != "merge to main" { - log.Info("skipping. not merge to main", repo.String(), repo.dirtyLabel.String()) - continue - } - if repo.status.CheckDirty() { - log.Info("skipping dirty", repo.String(), repo.dirtyLabel.String()) - continue - } - log.Info("found", repo.String(), repo.dirtyLabel.String()) - // repo.status.Update() - if repo.status.RunDevelMergeB() { - log.Warn("THINGS SEEM OK fullAutomation() returned true.") - } else { - log.Warn("THINGS FAILED fullAutomation() returned false") - return - } - repo.status.Update() - repo.newScan() - } - log.Warn("EVERYTHING WORKED") - reposwin.Enable() - }) - - grid1.NewButton("status.Update() all", func() { - for _, repo := range me.allrepos { - repo.status.Update() - repo.newScan() - } - }) + return true }