summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-21 16:35:21 -0600
committerJeff Carr <[email protected]>2025-02-21 16:35:21 -0600
commitf8dd6bca59bd66904eff05d1d33e117f816f46d9 (patch)
tree4a7d897805ba571173e51029effb6198acca1018
parentce938cc73bbd7849a4fd7de8e24e529fdb7dc8c9 (diff)
correctly cleans remote user branches finally!
-rw-r--r--doGui.go80
-rw-r--r--windowRepoProblems.go17
2 files changed, 30 insertions, 67 deletions
diff --git a/doGui.go b/doGui.go
index 8c70cd4..e4c3114 100644
--- a/doGui.go
+++ b/doGui.go
@@ -204,13 +204,13 @@ func drawWindow(win *gadgets.BasicWindow) {
me.found.AppendByGoPath(repo)
}
- makeStandardReposWindow(me.found)
+ makeStandardReposWindow("All repos", me.found)
})
me.repoDirtyB = grid.NewButton("dirty", func() {
me.found = new(gitpb.Repos)
findDirty()
- makeStandardReposWindow(me.found)
+ makeStandardReposWindow("dirty repos", me.found)
})
me.repoWritableB = grid.NewButton("writable", func() {
@@ -225,12 +225,12 @@ func drawWindow(win *gadgets.BasicWindow) {
me.found.AppendByGoPath(repo)
}
- makeStandardReposWindow(me.found)
+ makeStandardReposWindow("Repos that you have write access to", me.found)
})
me.repoDevelMergeB = grid.NewButton("needs merge to devel", func() {
findMergeToDevel()
- makeStandardReposWindow(me.found)
+ makeStandardReposWindow("repos to merge from user to devel", me.found)
})
var problemsWin *repoProblemsWindow
grid.NewButton("Repo Problems", func() {
@@ -334,40 +334,6 @@ func drawWindow(win *gadgets.BasicWindow) {
patchWin.initWindow()
patchWin.Show()
})
-
- /*
- grid.NewButton("Repo Window", func() {
- win.Disable()
- defer win.Enable()
- if reposWin != nil {
- if reposWin.Hidden() {
- reposWin.Show()
- } else {
- reposWin.Hide()
- }
- return
- }
- reposWin := new(repoWindow)
- reposWin.win = gadgets.RawBasicWindow("All git repositories in ~/go/src/")
- reposWin.win.Make()
-
- reposWin.box = reposWin.win.Box().NewBox("bw vbox", false)
- // me.reposwin.Draw()
- reposWin.win.Custom = func() {
- log.Warn("Repo Window close. hidden=true")
- // sets the hidden flag to false so Toggle() works
- reposWin.win.Hide()
- }
- reposWin.topbox = reposWin.repoMenu()
-
- reposWin.View = repolist.InitBox(me.forge, reposWin.box)
- reposWin.View.Enable()
-
- // need to update this logic
- reposWin.View.ScanRepositoriesOld()
- reposWin.win.Show()
- })
- */
}
// this is the magic that generates a window directly from the protocol buffer
@@ -394,34 +360,20 @@ func makeStandardReposGrid(pb *gitpb.Repos) *gitpb.ReposTable {
}
// this is the magic that generates a window directly from the protocol buffer
-func makeStandardReposWindow(pb *gitpb.Repos) {
- t := pb.NewTable("testDirty")
- sf := t.AddStringFunc("repo", func(r *gitpb.Repo) string {
- return r.GetGoPath()
- })
- // t.Custom = func() {
- // log.Info("close grid?")
- // }
- sf.Custom = func(r *gitpb.Repo) {
- log.Info("do button click on", r.GetGoPath())
+func makeStandardReposWindow(title string, pb *gitpb.Repos) *gitpb.ReposTable {
+ win := gadgets.RawBasicWindow(title)
+ win.Make()
+ win.Show()
+ win.Custom = func() {
+ // sets the hidden flag to false so Toggle() works
+ win.Hide()
}
- t.AddTimeFunc("age", func(repo *gitpb.Repo) time.Time {
- return repo.NewestTime()
- })
- t.AddMasterVersion()
- t.AddDevelVersion()
- t.AddUserVersion()
- t.AddCurrentBranchName()
- t.AddState()
+ box := win.Box().NewBox("bw vbox", false)
+
+ t := makeStandardReposGrid(pb)
+ t.SetParent(box)
t.ShowTable()
- /*
- t.AddStringFunc("zood", func(m *zoopb.Machine) string {
- return findVersion(m, "zood")
- })
- t.AddTimeFunc("age", func(m *zoopb.Machine) time.Time {
- return m.Laststamp.AsTime()
- })
- */
+ return t
}
func findMergeToDevel() {
diff --git a/windowRepoProblems.go b/windowRepoProblems.go
index b60125c..08e1f32 100644
--- a/windowRepoProblems.go
+++ b/windowRepoProblems.go
@@ -123,10 +123,21 @@ func makeRepoProblemsWindow() *repoProblemsWindow {
found := remoteUserBranchProblem()
group := box.NewGroup("test buttons")
group.NewButton("git branch delete", func() {
+ win.Disable()
+ defer win.Enable()
all := found.SortByFullPath()
for all.Scan() {
repo := all.Next()
- log.Info("git branch -D jcarr", repo.GetGoPath())
+ brname := repo.GetUserBranchName()
+ // git push origin --delete jcarr
+ cmd := []string{"git", "push", "origin", "--delete", brname}
+ log.Info(repo.GetGoPath(), cmd)
+ repo.RunVerbose(cmd)
+
+ // git branch --delete --remote origin/jcarr
+ cmd = []string{"git", "branch", "--delete", "--remote", "origin/" + brname}
+ log.Info(repo.GetGoPath(), cmd)
+ repo.RunVerbose(cmd)
}
})
@@ -144,14 +155,14 @@ func makeRepoProblemsWindow() *repoProblemsWindow {
txt = fmt.Sprintf("remote devel != local devel (%d)", found.Len())
grid.NewButton(txt, func() {
found := develRemoteProblem()
- makeStandardReposWindow(found)
+ makeStandardReposWindow(txt, found)
})
found = masterRemoteProblem()
txt = fmt.Sprintf("remote master != local master (%d)", found.Len())
grid.NewButton(txt, func() {
found := masterRemoteProblem()
- makeStandardReposWindow(found)
+ makeStandardReposWindow(txt, found)
})
grid.NextRow()