apply patches working more smoothly

This commit is contained in:
Jeff Carr 2025-09-06 20:08:28 -05:00
parent a6c0edb89d
commit f6a79c3be8
1 changed files with 22 additions and 0 deletions

View File

@ -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 {