start reporting applied patches

This commit is contained in:
Jeff Carr 2025-09-06 17:14:46 -05:00
parent 893c88bbf5
commit 1087b39f9c
3 changed files with 40 additions and 2 deletions

View File

@ -38,8 +38,6 @@ func doMergeDevel() (*gitpb.Repos, error) {
break
}
done.Append(repo)
// only do one at a time. to debug this
break
}
configSave = true
return done, err

View File

@ -81,6 +81,15 @@ func doPatch() error {
}
me.forge.Patchsets.PrintTable()
// return doPatchList()
applied := findApplied()
// for patch := range applied.IterAll() {
// log.Info("SEND APPLIED: newhash:", patch.NewHash, "commithash:", patch.CommitHash, "patch", patch.Namespace)
// }
newpb, err := applied.HttpPostVerbose(myServer(), "applied")
if err != nil {
return err
}
newpb.PrintTable()
return nil
}

View File

@ -309,3 +309,34 @@ func findExpired() *forgepb.Patches {
return found
}
func findApplied() *forgepb.Patches {
var pset *forgepb.Patches
for found := range me.forge.Patchsets.IterAll() {
if found.Name == "forge auto commit" {
pset = found.Patches
}
}
if pset == nil {
log.Info("failed to find 'forge auto commit'")
return pset
}
found := forgepb.NewPatches()
for patch := range pset.IterAll() {
cmd := []string{"git", "merge-base", "--is-ancestor", patch.CommitHash, "devel"}
repo := me.forge.Repos.FindByNamespace(patch.Namespace)
_, err := repo.RunStrict(cmd)
if err != nil {
// log.Info("NOT APPLIED", patch.Namespace, result, err)
// log.Info("NOT APPLIED newhash:", patch.NewHash, "commithash:", patch.CommitHash, "patch", patch.Namespace)
} else {
// log.Info("APPLIED newhash:", patch.NewHash, "commithash:", patch.CommitHash, "patch", patch.Namespace)
found.Append(patch)
}
}
return found
}