From f6a79c3be8239e80e39c8992b71b43fdc95d61bb Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 6 Sep 2025 20:08:28 -0500 Subject: [PATCH] apply patches working more smoothly --- doPatch.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doPatch.go b/doPatch.go index 37f255e..ee74dca 100644 --- a/doPatch.go +++ b/doPatch.go @@ -6,6 +6,7 @@ package main import ( "path/filepath" + "go.wit.com/lib/fhelp" "go.wit.com/lib/protobuf/forgepb" "go.wit.com/log" ) @@ -60,12 +61,17 @@ func doPatch() error { if argv.Patch.List != nil { var changed bool + newpatches := forgepb.NewPatches() for pset := range me.forge.Patchsets.IterAll() { log.Info(pset.Uuid) for patch := range pset.Patches.IterAll() { if setNewCommitHash(patch) { changed = true } + if patch.NewHash == "na" { + newpatches.Append(patch) + log.Info("apply this patch?") + } } /* @@ -84,6 +90,22 @@ func doPatch() error { } } me.forge.Patchsets.PrintTable() + if newpatches.Len() != 0 { + for patch := range newpatches.IterAll() { + log.Info("new patch:", patch.CommitHash, patch.NewHash, patch.Filename) + repo := me.forge.FindByGoPath(patch.Namespace) + if repo == nil { + log.Info("\tCould not find namespace:", patch.Namespace) + continue + } + if fhelp.QuestionUser("apply this patch?") { + newhash, err := applyAndTrackPatch(repo, patch) + log.Info("apply results:", newhash, err) + } + } + return log.Errorf("patches need to be applied") + } + // return doPatchList() applied := findApplied() if applied.Len() == 0 {