From 906d50a771292652e896496708e247fe4be695fa Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 28 Aug 2025 17:40:52 -0500 Subject: test --- doMerge.go | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'doMerge.go') diff --git a/doMerge.go b/doMerge.go index 3362c9d..ad1c45e 100644 --- a/doMerge.go +++ b/doMerge.go @@ -12,17 +12,9 @@ import ( ) func doMerge() error { - if err := loadConfigfile(); err != nil { - if argv.Force == true { - me.all = forgepb.NewPatchsets() - } else { - return err - } - } - mergePatchsets() - if err := savePatchsets(); err != nil { + if err := SavePatchsets(); err != nil { log.Warn("savePatchsets() failed", err) return err } @@ -30,7 +22,6 @@ func doMerge() error { } func findAutoPatchset() *forgepb.Patchset { - for pset := range me.all.IterAll() { if pset.Name == "forge auto commit" { return pset @@ -71,7 +62,10 @@ func addRandomPatch(patch *forgepb.Patch) error { return nil } +// adds a patchset or just the patches func addPatchset(filename string, pb *forgepb.Patchset) { + // if the name of the patchset is "forge auto commit" + // then just add all the patches if pb.Name == "forge auto commit" { author := "Author: " + pb.GitAuthorName author += " <" + pb.GitAuthorEmail + ">" @@ -88,15 +82,25 @@ func addPatchset(filename string, pb *forgepb.Patchset) { addRandomPatch(patch) } } - // add each of the patches to the general pool - } else { - // Clone() this protobuf into me.all - var newpb *forgepb.Patchset - newpb = proto.Clone(pb).(*forgepb.Patchset) - if newpb != nil { - me.all.Patchsets = append(me.all.Patchsets, newpb) + return + } + + // if you got here, this patchset was submitted with a name + + // Has this patchset already been submitted? + for pset := range me.all.IterAll() { + if pset.Uuid == pb.Uuid { + log.Info("ALREADY ADDED", pset.Uuid, pset.Name) + return } } + + // Clone() this protobuf into me.all + var newpb *forgepb.Patchset + newpb = proto.Clone(pb).(*forgepb.Patchset) + if newpb != nil { + me.all.Patchsets = append(me.all.Patchsets, newpb) + } } func mergePatchsets() { -- cgit v1.2.3