diff options
| author | Jeff Carr <[email protected]> | 2025-08-28 17:40:52 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-08-28 19:30:59 -0500 |
| commit | 906d50a771292652e896496708e247fe4be695fa (patch) | |
| tree | 02ab1d6c7d507bde9ab8d596fca61fe2f369e838 /doMerge.go | |
| parent | 86ac85dd5b5432ca3d1ff935b6ff6582ba37c287 (diff) | |
test
Diffstat (limited to 'doMerge.go')
| -rw-r--r-- | doMerge.go | 38 |
1 files changed, 21 insertions, 17 deletions
@@ -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() { |
