button to show all patches

This commit is contained in:
Jeff Carr 2025-03-25 07:27:21 -05:00
parent aed4c92713
commit 99e30376f0
3 changed files with 32 additions and 8 deletions

View File

@ -237,7 +237,7 @@ func drawWindow(win *gadgets.GenericWindow) {
all := me.psets.All()
for all.Scan() {
pset := all.Next()
AddNotDonePatches(notdone, pset)
AddNotDonePatches(notdone, pset, false)
}
for patch := range notdone.IterAll() {

View File

@ -57,7 +57,24 @@ func makePatchesWin(patches *forgepb.Patches) *stdPatchTableWin {
grid.NewLabel(fmt.Sprintf("total repos"))
grid.NextRow()
grid.NewButton("reload", func() {
grid.NewButton("show all", func() {
if me.psets == nil {
log.Info("No Patchsets loaded")
return
}
notdone := new(forgepb.Patches)
all := me.psets.All()
for all.Scan() {
pset := all.Next()
AddNotDonePatches(notdone, pset, true)
}
for patch := range notdone.IterAll() {
comment := cleanSubject(patch.Comment)
log.Info("new patch:", patch.NewHash, "commithash:", patch.CommitHash, patch.RepoNamespace, comment)
}
dwin.doPatchesTable(notdone)
})
grid.NewButton("Apply All", func() {
var count int
@ -135,6 +152,11 @@ func AddPatchesPB(tbox *gui.Node, pb *forgepb.Patches) *forgepb.PatchesTable {
t.SetParent(tbox)
gitam := t.AddButtonFunc("apply", func(p *forgepb.Patch) string {
rn := p.RepoNamespace
if repo := me.forge.FindByGoPath(rn); repo == nil {
// log.Info("Could not figure out repo path", rn)
return ""
}
return "git am"
})
gitam.Custom = func(p *forgepb.Patch) {

View File

@ -145,7 +145,7 @@ func makePatchsetsWin() *stdPatchsetTableWin {
all := me.psets.All()
for all.Scan() {
pset := all.Next()
AddNotDonePatches(notdone, pset)
AddNotDonePatches(notdone, pset, false)
}
for patch := range notdone.IterAll() {
@ -266,7 +266,7 @@ func setPatchsetState(p *forgepb.Patchset) {
// log.Info("patch:", patch.StartHash, patch.CommitHash, patch.RepoNamespace, patch.Filename)
repo := me.forge.FindByGoPath(patch.RepoNamespace)
if repo == nil {
log.Info("couldn't find repo", patch.RepoNamespace)
log.Info("could not find repo", patch.RepoNamespace)
bad = true
continue
}
@ -332,7 +332,7 @@ func setNewCommitHash(p *forgepb.Patchset) bool {
repo := me.forge.FindByGoPath(patch.RepoNamespace)
if repo == nil {
log.Info("couldn't find repo", patch.RepoNamespace)
log.Info("could not find repo", patch.RepoNamespace)
continue
}
@ -356,7 +356,7 @@ func setNewCommitHash(p *forgepb.Patchset) bool {
return done
}
func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Patchset) {
func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Patchset, full bool) {
for patch := range pset.Patches.IterAll() {
comment := cleanSubject(patch.Comment)
@ -367,8 +367,10 @@ func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Patchset) {
repo := me.forge.FindByGoPath(patch.RepoNamespace)
if repo == nil {
log.Info("couldn't find repo", patch.RepoNamespace)
notdone.Append(patch)
log.Info("could not find repo", patch.RepoNamespace)
if full {
notdone.AppendByCommitHash(patch) // double check to ensure the commit hash isn't added twice
}
continue
}