diff --git a/doGui.go b/doGui.go index 7d91db7..c8c997a 100644 --- a/doGui.go +++ b/doGui.go @@ -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() { diff --git a/windowPatches.go b/windowPatches.go index b12a061..3eb1d7b 100644 --- a/windowPatches.go +++ b/windowPatches.go @@ -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) { diff --git a/windowPatchsets.go b/windowPatchsets.go index 4251a19..9c005fe 100644 --- a/windowPatchsets.go +++ b/windowPatchsets.go @@ -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 }