add common patch functions between forge & forged

This commit is contained in:
Jeff Carr 2025-08-28 19:15:48 -05:00
parent 22f823bebe
commit b55add4b47
2 changed files with 5 additions and 2 deletions

View File

@ -44,7 +44,6 @@ func findAutoPatchset() *forgepb.Patchset {
// adds submitted patches not specifically assigned to a patchset // adds submitted patches not specifically assigned to a patchset
// to the generic patchset called "forge auto commit" // to the generic patchset called "forge auto commit"
func addRandomPatch(patch *forgepb.Patch) error { func addRandomPatch(patch *forgepb.Patch) error {
// ignore patch if it's already here // ignore patch if it's already here
if findPatch(patch) { if findPatch(patch) {
log.Info("already found patch", patch.CommitHash, patch.Namespace) log.Info("already found patch", patch.CommitHash, patch.Namespace)
@ -62,6 +61,7 @@ func addRandomPatch(patch *forgepb.Patch) error {
return nil return nil
} }
/*
// adds a patchset or just the patches // adds a patchset or just the patches
func addPatchset(filename string, pb *forgepb.Patchset) { func addPatchset(filename string, pb *forgepb.Patchset) {
// if the name of the patchset is "forge auto commit" // if the name of the patchset is "forge auto commit"
@ -102,6 +102,7 @@ func addPatchset(filename string, pb *forgepb.Patchset) {
me.forge.Patchsets.Patchsets = append(me.forge.Patchsets.Patchsets, newpb) me.forge.Patchsets.Patchsets = append(me.forge.Patchsets.Patchsets, newpb)
} }
} }
*/
func mergePatchsets() { func mergePatchsets() {
dirname := filepath.Join(LIBDIR, "patchset/") dirname := filepath.Join(LIBDIR, "patchset/")
@ -128,7 +129,7 @@ func mergePatchsets() {
fmt.Println(entry.Name(), err) fmt.Println(entry.Name(), err)
continue continue
} }
addPatchset(entry.Name(), p) me.forge.AddPatchset(p)
} }
} }
} }

View File

@ -121,6 +121,8 @@ func savePatchset(w http.ResponseWriter, msg []byte) error {
regfile.Write(msg) regfile.Write(msg)
regfile.Close() regfile.Close()
me.forge.AddPatchset(m)
response := forgepb.NewPatches() // this sets the proper handshake protobuf UUID response := forgepb.NewPatches() // this sets the proper handshake protobuf UUID
all := m.Patches.SortByFilename() all := m.Patches.SortByFilename()
for all.Scan() { for all.Scan() {