diff options
| author | Jeff Carr <[email protected]> | 2025-09-05 12:53:05 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-05 12:53:05 -0500 |
| commit | e639f7d7b7930185aa319a91317087015887d75e (patch) | |
| tree | 27228d32cd811adb6ead90b5db93fa7b725c1284 /windowPatches.go | |
| parent | 790c48e0d0ef2fde8583820b8ab834449bf00ac0 (diff) | |
set patch NewHash
Diffstat (limited to 'windowPatches.go')
| -rw-r--r-- | windowPatches.go | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/windowPatches.go b/windowPatches.go index 31ed924..c2d8c4b 100644 --- a/windowPatches.go +++ b/windowPatches.go @@ -133,13 +133,27 @@ func (dwin *stdPatchTableWin) doPatchesTable(currentPatches *forgepb.Patches) { } // used by the PB table -func funcApplyPatch(p *forgepb.Patch) string { +func applyPatchLabel(p *forgepb.Patch) string { rn := p.Namespace if repo := me.forge.FindByGoPath(rn); repo == nil { // log.Info("Could not figure out repo path", rn) return "" } - return "git am" + if p.NewHash == "na" { + return "git am" + } + if p.NewHash == "" { + return "new" + } + return "done" +} + +func applyPatchClick(p *forgepb.Patch) { + if err := applyPatchNew(p); err != nil { + log.Info("git am failed on file", p.Filename, "with error", err) + return + } + log.Info("ran: git am", p.Filename, "ok") } // define what rows to have in the protobuf table @@ -148,21 +162,8 @@ func AddPatchesPB(tbox *gui.Node, pb *forgepb.Patches) *forgepb.PatchesTable { t.NewUuid() t.SetParent(tbox) - gitam := t.AddButtonFunc("apply", func(p *forgepb.Patch) string { - rn := p.Namespace - 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) { - if err := applyPatchNew(p); err != nil { - log.Info("git am failed on file", p.Filename, "with error", err) - return - } - log.Info("ran: git am", p.Filename, "ok") - } + gitam := t.AddButtonFunc("apply", applyPatchLabel) + gitam.Custom = applyPatchClick t.AddCommitHash() t.AddNamespace() |
