kinda merges repos

This commit is contained in:
Jeff Carr 2025-08-28 15:01:15 -05:00
parent 7a547a203d
commit 684c5b1dad
2 changed files with 28 additions and 10 deletions

View File

@ -5,7 +5,7 @@ BUILDTIME = $(shell date +%Y.%m.%d_%H%M)
all: install
forged merge
# forged list
forged list
build: goimports
GO111MODULE=off go build \

View File

@ -16,9 +16,7 @@ func doMerge() error {
}
mergePatchsets()
for pset := range me.all.IterAll() {
showPatchsets(pset)
}
if err := savePatchsets(); err != nil {
log.Warn("savePatchsets() failed", err)
return err
@ -28,16 +26,35 @@ func doMerge() error {
// adds submitted patches not specifically assigned to a patchset
// to the generic patchset called "forge auto commit"
func addRandomPatch(patch *forgepb.Patch) {
func addRandomPatch(patch *forgepb.Patch) error {
var fauto *forgepb.Patchset
// ignore patch if it's already here
if findPatch(patch) {
log.Info("already found patch", patch.CommitHash, patch.Namespace)
return nil
}
for pset := range me.all.IterAll() {
if pset.Name == "forge auto commit" {
fauto = pset
break
}
}
if fauto == nil {
fauto = new(forgepb.Patchset)
fauto.Name = "forge auto commit"
fauto.Patches = forgepb.NewPatches()
me.all.Patchsets = append(me.all.Patchsets, fauto)
log.Warn("had to create 'forge auto commit' patchset")
// return log.Errorf("no default place yet")
}
newpb := proto.Clone(patch).(*forgepb.Patch)
if newpb != nil {
pset.Patches.Append(newpb)
if newpb == nil {
return log.Errorf("proto.Clone returned nil")
}
}
}
log.Warn("patchset.Name == 'forge auto commit' could not be found so the patch in", patch.Namespace, "could not be added")
fauto.Patches.Patches = append(fauto.Patches.Patches, newpb)
return nil
}
func addPatchset(filename string, pb *forgepb.Patchset) {
@ -54,6 +71,7 @@ func addPatchset(filename string, pb *forgepb.Patchset) {
// log.Info("\talready found!!!!!!!", pset.Uuid, patch.Namespace)
} else {
log.Info("\tnew patch:", filename, pb.Name, pb.Comment, author)
addRandomPatch(patch)
}
}
// add each of the patches to the general pool