From be3e625f1585c24d1b755efdbd79bacb932b5a29 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 19 Feb 2025 17:54:45 -0600 Subject: [PATCH] "apply all" button for a patchset --- windowPatchset.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/windowPatchset.go b/windowPatchset.go index 2ac5138..6f9c6a1 100644 --- a/windowPatchset.go +++ b/windowPatchset.go @@ -87,6 +87,30 @@ func makePatchWindow(pset *forgepb.Patchset) *patchWindow { grid.NewLabel(pset.StartBranchHash) grid.NewLabel("end branch: " + pset.EndBranchName) grid.NewLabel(pset.EndBranchHash) + grid.NewButton("Apply All", func() { + var count int + all := pset.Patches.SortByFilename() + for all.Scan() { + p := all.Next() + rn := p.RepoNamespace + repo := me.forge.FindByGoPath(rn) + if repo == nil { + log.Info("Could not figure out repo path", rn) + return + } + filename, err := savePatch(p) + if err != nil { + log.Info("savePatch() failed", err) + return + } + count += 1 + if err := applyPatch(repo, filename); err != nil { + log.Info("warn user of git am error", err) + return + } + } + log.Info("ALL PATCHES WORKED! count =", count) + }) grid.NextRow() g := pw.stack.NewGroup("PatchSet List")