diff options
| author | Jeff Carr <[email protected]> | 2025-08-28 15:01:15 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-08-28 19:30:59 -0500 |
| commit | 684c5b1dad1ebaa6a9443641e65e2789c3c85911 (patch) | |
| tree | daf3a4c0ecfed3579384648f3de833fb9eb6d555 /doMerge.go | |
| parent | 7a547a203dffc756e1c52985fee846c4506596a5 (diff) | |
kinda merges repos
Diffstat (limited to 'doMerge.go')
| -rw-r--r-- | doMerge.go | 36 |
1 files changed, 27 insertions, 9 deletions
@@ -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" { - newpb := proto.Clone(patch).(*forgepb.Patch) - if newpb != nil { - pset.Patches.Append(newpb) - } + fauto = pset + break } } - log.Warn("patchset.Name == 'forge auto commit' could not be found so the patch in", patch.Namespace, "could not be added") + + 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 { + return log.Errorf("proto.Clone returned nil") + } + 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 |
