summaryrefslogtreecommitdiff
path: root/doMerge.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-08-28 17:40:52 -0500
committerJeff Carr <[email protected]>2025-08-28 19:30:59 -0500
commit906d50a771292652e896496708e247fe4be695fa (patch)
tree02ab1d6c7d507bde9ab8d596fca61fe2f369e838 /doMerge.go
parent86ac85dd5b5432ca3d1ff935b6ff6582ba37c287 (diff)
test
Diffstat (limited to 'doMerge.go')
-rw-r--r--doMerge.go38
1 files changed, 21 insertions, 17 deletions
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() {