correctly cleans remote user branches finally!

This commit is contained in:
Jeff Carr 2025-02-21 16:35:21 -06:00
parent ce938cc73b
commit f8dd6bca59
2 changed files with 30 additions and 67 deletions

View File

@ -204,13 +204,13 @@ func drawWindow(win *gadgets.BasicWindow) {
me.found.AppendByGoPath(repo) me.found.AppendByGoPath(repo)
} }
makeStandardReposWindow(me.found) makeStandardReposWindow("All repos", me.found)
}) })
me.repoDirtyB = grid.NewButton("dirty", func() { me.repoDirtyB = grid.NewButton("dirty", func() {
me.found = new(gitpb.Repos) me.found = new(gitpb.Repos)
findDirty() findDirty()
makeStandardReposWindow(me.found) makeStandardReposWindow("dirty repos", me.found)
}) })
me.repoWritableB = grid.NewButton("writable", func() { me.repoWritableB = grid.NewButton("writable", func() {
@ -225,12 +225,12 @@ func drawWindow(win *gadgets.BasicWindow) {
me.found.AppendByGoPath(repo) 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() { me.repoDevelMergeB = grid.NewButton("needs merge to devel", func() {
findMergeToDevel() findMergeToDevel()
makeStandardReposWindow(me.found) makeStandardReposWindow("repos to merge from user to devel", me.found)
}) })
var problemsWin *repoProblemsWindow var problemsWin *repoProblemsWindow
grid.NewButton("Repo Problems", func() { grid.NewButton("Repo Problems", func() {
@ -334,40 +334,6 @@ func drawWindow(win *gadgets.BasicWindow) {
patchWin.initWindow() patchWin.initWindow()
patchWin.Show() 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 // 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 // this is the magic that generates a window directly from the protocol buffer
func makeStandardReposWindow(pb *gitpb.Repos) { func makeStandardReposWindow(title string, pb *gitpb.Repos) *gitpb.ReposTable {
t := pb.NewTable("testDirty") win := gadgets.RawBasicWindow(title)
sf := t.AddStringFunc("repo", func(r *gitpb.Repo) string { win.Make()
return r.GetGoPath() win.Show()
}) win.Custom = func() {
// t.Custom = func() { // sets the hidden flag to false so Toggle() works
// log.Info("close grid?") win.Hide()
// }
sf.Custom = func(r *gitpb.Repo) {
log.Info("do button click on", r.GetGoPath())
} }
t.AddTimeFunc("age", func(repo *gitpb.Repo) time.Time { box := win.Box().NewBox("bw vbox", false)
return repo.NewestTime()
}) t := makeStandardReposGrid(pb)
t.AddMasterVersion() t.SetParent(box)
t.AddDevelVersion()
t.AddUserVersion()
t.AddCurrentBranchName()
t.AddState()
t.ShowTable() t.ShowTable()
/* return t
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()
})
*/
} }
func findMergeToDevel() { func findMergeToDevel() {

View File

@ -123,10 +123,21 @@ func makeRepoProblemsWindow() *repoProblemsWindow {
found := remoteUserBranchProblem() found := remoteUserBranchProblem()
group := box.NewGroup("test buttons") group := box.NewGroup("test buttons")
group.NewButton("git branch delete", func() { group.NewButton("git branch delete", func() {
win.Disable()
defer win.Enable()
all := found.SortByFullPath() all := found.SortByFullPath()
for all.Scan() { for all.Scan() {
repo := all.Next() 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()) txt = fmt.Sprintf("remote devel != local devel (%d)", found.Len())
grid.NewButton(txt, func() { grid.NewButton(txt, func() {
found := develRemoteProblem() found := develRemoteProblem()
makeStandardReposWindow(found) makeStandardReposWindow(txt, found)
}) })
found = masterRemoteProblem() found = masterRemoteProblem()
txt = fmt.Sprintf("remote master != local master (%d)", found.Len()) txt = fmt.Sprintf("remote master != local master (%d)", found.Len())
grid.NewButton(txt, func() { grid.NewButton(txt, func() {
found := masterRemoteProblem() found := masterRemoteProblem()
makeStandardReposWindow(found) makeStandardReposWindow(txt, found)
}) })
grid.NextRow() grid.NextRow()