diff options
| author | Jeff Carr <[email protected]> | 2025-03-04 04:29:14 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-04 04:29:14 -0600 |
| commit | cad5321516abbef8210134fd4b5978cd57f84274 (patch) | |
| tree | 50faf1aeb0c62faf5e2231e8592d798c56f7b028 /windowModeMaster.go | |
| parent | 6cb34ae52cbbeb21f00ca2129d8494002b096d29 (diff) | |
general code and gui reorgv0.22.101
Diffstat (limited to 'windowModeMaster.go')
| -rw-r--r-- | windowModeMaster.go | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/windowModeMaster.go b/windowModeMaster.go index e01752b..e09d991 100644 --- a/windowModeMaster.go +++ b/windowModeMaster.go @@ -5,6 +5,7 @@ package main import ( "go.wit.com/lib/gadgets" + "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) @@ -82,5 +83,66 @@ func makeModeMasterWin() *gadgets.GenericWindow { f() }) + + grid.NewButton("reset user branches (?)", func() { + resetUserBranchesWindow() + }) return win } + +func resetUserBranchesWindow() { + found := gitpb.NewRepos() + all := me.forge.Repos.SortByFullPath() + for all.Scan() { + repo := all.Next() + uname := repo.GetUserBranchName() + dname := repo.GetDevelBranchName() + if repo.GetCurrentBranchName() == uname { + log.Info("Repo is on the user branch. Can't delete it.", repo.GetGoPath()) + continue + } + b1 := repo.CountDiffObjects(uname, dname) + b2 := repo.CountDiffObjects(dname, uname) + log.Info("user vs devel count", b1, b2) + if b1 == 0 && b2 == 0 { + cmd := []string{"git", "branch", "-D", uname} + log.Info(repo.GetGoPath(), cmd) + repo.RunVerbose(cmd) + repo.Reload() + continue + } + found.Append(repo) + + } + + win := gadgets.RawBasicWindow("reset user branches") + win.Make() + win.Show() + win.Custom = func() { + // sets the hidden flag to false so Toggle() works + win.Hide() + } + box := win.Box().NewBox("bw vbox", false) + + group := box.NewGroup("test buttons") + hbox := group.Box().Horizontal() + hbox.NewButton("force delete user branch", func() { + win.Disable() + defer win.Enable() + all := found.SortByFullPath() + for all.Scan() { + repo := all.Next() + brname := repo.GetUserBranchName() + cmd := []string{"git", "branch", "-D", brname} + log.Info(repo.GetGoPath(), cmd) + repo.RunVerbose(cmd) + repo.Reload() + } + me.forge.SetConfigSave(true) + me.forge.ConfigSave() + }) + + t := makeStandardReposGrid(found) + t.SetParent(box) + t.ShowTable() +} |
