diff options
| author | Jeff Carr <[email protected]> | 2024-02-20 14:44:38 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-20 14:44:38 -0600 |
| commit | e927975dc890216c7172f711222cfdf283c0dd1c (patch) | |
| tree | 44bf3b5a0cbba18fea5fd94182bb591d63b44f15 /globalDisplayOptions.go | |
| parent | d84420e443315d14d408a458d486c2b7a805037f (diff) | |
reorg interface. it's almost working again
Diffstat (limited to 'globalDisplayOptions.go')
| -rw-r--r-- | globalDisplayOptions.go | 205 |
1 files changed, 33 insertions, 172 deletions
diff --git a/globalDisplayOptions.go b/globalDisplayOptions.go index 606c767..431a0be 100644 --- a/globalDisplayOptions.go +++ b/globalDisplayOptions.go @@ -1,8 +1,6 @@ package main import ( - "strings" - "go.wit.com/gui" "go.wit.com/lib/debugger" "go.wit.com/lib/gui/logsettings" @@ -11,12 +9,16 @@ import ( ) func showHideRepos(repo *repolist.Repo) { + if repo.GoPath() == "go.wit.com/dev/alexflint/arg" { + log.Info("found autoHideReleased() =", me.autoHideReleased.Checked()) + log.Info("found alexflint/arg IsReleased() =", repo.Status.IsReleased()) + } // always show dirty repos if repo.IsDirty() { repo.Show() return } - // always show repos that have not been merged to main + // always show repos that have not been merged ? if repo.GoState() == "merge to devel" { repo.Show() return @@ -30,30 +32,8 @@ func showHideRepos(repo *repolist.Repo) { return } } - if me.autoHidePerfect.Checked() { - if repo.State() == "PERFECT" { - repo.Hide() - return - } - } - if me.autoReleased.Checked() { - if repo.GoState() == "RELEASED" { - repo.Hide() - return - } - } - repo.Show() -} - -func globalDisplayShow(repo *repolist.Repo) { - if me.autoHideReadOnly.Checked() { - if repo.Status.ReadOnly() { - repo.Hide() - return - } - } - if me.autoHidePerfect.Checked() { - if repo.State() == "PERFECT" { + if me.autoHideReleased.Checked() { + if repo.Status.IsReleased() { repo.Hide() return } @@ -79,191 +59,72 @@ func globalDisplayOptions(box *gui.Node) { hidegrid.NextRow() me.autoHideReadOnly = hidegrid.NewCheckbox("Hide read-only repos").SetChecked(true) - me.autoHideReadOnly.Custom = func() { - log.Info("registered hide function to globalDisplayShow()") - me.repos.View.RegisterHideFunction(globalDisplayShow) - } + // me.autoHideReadOnly.Custom = func() { + // log.Info("registered hide function to globalDisplayShow()") + // me.repos.View.RegisterHideFunction(globalDisplayShow) + // } hidegrid.NextRow() - me.autoHidePerfect = hidegrid.NewCheckbox("Hide Perfectly clean repos").SetChecked(true) - me.autoHidePerfect.Custom = func() { - log.Info("registered hide function to showHideRepos()") - me.repos.View.RegisterHideFunction(showHideRepos) - } - hidegrid.NextRow() - - me.autoReleased = hidegrid.NewCheckbox("Hide RELEASED repos").SetChecked(false) - me.autoReleased.Custom = func() { - if me.autoReleased.Checked() { - for _, repo := range me.repos.View.AllRepos() { - if repo.GoState() == "RELEASED" { - repo.Hide() - } - } - } else { - for _, repo := range me.repos.View.AllRepos() { - repo.Show() - } - } - } + me.autoHideReleased = hidegrid.NewCheckbox("Hide Released repos").SetChecked(true) hidegrid.NextRow() me.ignoreWhitelist = hidegrid.NewCheckbox("ignore whitelist (are you sure?)").SetChecked(false) hidegrid.NextRow() me.scanEveryMinute = hidegrid.NewCheckbox("Scan every minute").SetChecked(false) + me.scanEveryMinute.Custom = func() { + me.repos.View.SetAutoScan(me.scanEveryMinute.Checked()) + } hidegrid.NewButton("scan now", func() { log.Info("re-scanning repos now") i, s := me.repos.View.ScanRepositories() log.Info("re-scanning repos done", i, s) - me.duration.SetText(s) + // me.duration.SetText(s) }) - me.duration = hidegrid.NewLabel("") + me.duration = me.repos.View.MirrorScanDuration() + hidegrid.Append(me.duration) + hidegrid.NextRow() + group1 = vbox.NewGroup("prep for release") grid := group1.NewGrid("test", 0, 0) - grid.NewButton("git checkout master", func() { - setBranchToMaster() - }) - - grid.NewButton("find first repo", func() { - // set the target versions + grid.NewButton("set target version", func() { setTargetVersion() - - // have to run this twice for now. not sure why - scanForReady() - scanForReady() - - findNextDirty("") }) - - me.setBranchesToMasterB = grid.NewButton("set all branches to master", func() { - me.Disable() - for _, repo := range me.repos.View.AllRepos() { - if repo.Status.ReadOnly() { - continue - } - if whitelist(repo.GoPath()) { - continue - } - if repo.Status.CheckoutMaster() { - log.Warn("set master branch worked", repo.Name()) - repo.Status.UpdateNew() - } else { - repo.Status.UpdateNew() - log.Warn("set master branch failed", repo.Name()) - log.Warn("set master branch failed", repo.Name()) - log.Warn("set master branch failed", repo.Name()) - } - } - me.Enable() - me.setBranchesToMasterB.Disable() - }) - var longB *gui.Node longB = grid.NewButton("redo all go.sum", func() { - longB.Disable() me.Disable() + var worked bool = true for _, repo := range me.repos.View.AllRepos() { if whitelist(repo.GoPath()) { continue } - ok, err := repo.Status.MakeRedomod() + ok, err := me.repos.View.CheckValidGoSum(repo) if !ok { log.Info("redo go.sum failed on", repo.GoPath(), err) - me.Enable() - longB.Enable() - longB.SetLabel("FAILED") - return + worked = false } } - log.Info("redo go.sum finished ok!") - longB.Disable() + log.Info("redo go.sum finished with", worked) me.Enable() - longB.Enable() - }) - - grid.NewButton("set target version", func() { - setTargetVersion() - }) - grid.NextRow() - - grid.NewButton("rm -f go.mod go.sum", func() { - me.Disable() - for _, repo := range me.repos.View.AllRepos() { - if whitelist(repo.GoPath()) { - continue - } - if repo.Status.ReadOnly() { - continue - } - repo.Status.RunCmd([]string{"rm", "-f", "go.mod", "go.sum"}) + longB.SetLabel("go.sum files created") + if worked { + longB.Disable() } - me.Enable() }) - grid.NewButton("git reset --hard", func() { + me.setBranchesToMasterB = grid.NewButton("set all branches to master", func() { me.Disable() - for _, repo := range me.repos.View.AllRepos() { - if whitelist(repo.GoPath()) { - log.Warn("skipping whitelist", repo.Name()) - continue - } - log.Warn("running git reset --hard", repo.Name()) - repo.Status.RunCmd([]string{"git", "reset", "--hard"}) + defer me.Enable() + if setAllBranchesToMaster() { + // if it succeeds, disable this button + me.setBranchesToMasterB.Disable() } - me.Enable() }) - grid.NewButton("git ls-files |grep go.mod", func() { - // var all []string - for _, repo := range me.repos.View.AllRepos() { - log.Info("repo:", repo.Name()) - if repo.Status.ReadOnly() { - continue - } - if whitelist(repo.GoPath()) { - log.Warn("skipping whitelist", repo.GoPath()) - continue - } - good, files := repo.Status.GitLsFiles() - if !good { - log.Warn("Something went wrong", repo.GoPath()) - continue - } - for _, filename := range strings.Split(files, "\n") { - log.Info("\tfile", filename) - if filename == "go.mod" { - log.Info("Found go.mod. does version match release version?") - log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion()) - if repo.Status.GetLastTagVersion() != repo.Status.GetTargetVersion() { - log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion()) - log.Info("Found go.sum. version mismatch") - setCurrentRepo(repo, "VERY BROKEN", "rewind go.mod commit") - return - } - } - if filename == "go.sum" { - log.Info("Found go.sum. does version match release version?") - log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion()) - if repo.Status.GetLastTagVersion() != repo.Status.GetTargetVersion() { - log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion()) - log.Info("Found go.sum. version mismatch") - setCurrentRepo(repo, "VERY BROKEN", "rewind go.mod commit") - return - } - } - } - } - log.Info("All repos seem okay") - }) grid.NextRow() - grid.NewButton("scanForReady()", func() { - scanForReady() - }) - group2 := vbox.NewGroup("Debugger") dbggrid := group2.NewGrid("gdb", 0, 0) dbggrid.NewButton("logging Window", func() { |
