changes for new .proto files

This commit is contained in:
Jeff Carr 2025-09-23 10:17:06 -05:00
parent 2b6107fa51
commit ada923ea05
3 changed files with 14 additions and 14 deletions

View File

@ -21,7 +21,7 @@ func doMerge() error {
return nil return nil
} }
func findAutoPatchset() *forgepb.Patchset { func findAutoPatchset() *forgepb.Set {
for pset := range me.forge.Patchsets.IterAll() { for pset := range me.forge.Patchsets.IterAll() {
if pset.Name == "forge auto commit" { if pset.Name == "forge auto commit" {
return pset return pset
@ -29,14 +29,14 @@ func findAutoPatchset() *forgepb.Patchset {
} }
} }
var fauto *forgepb.Patchset var fauto *forgepb.Set
log.Warn("findAutoPatchset() had to create 'forge auto commit'") log.Warn("findAutoPatchset() had to create 'forge auto commit'")
if fauto == nil { if fauto == nil {
fauto = new(forgepb.Patchset) fauto = new(forgepb.Set)
fauto.Name = "forge auto commit" fauto.Name = "forge auto commit"
fauto.Patches = forgepb.NewPatches() fauto.Patches = forgepb.NewPatches()
fauto.Uuid = uuid.New().String() fauto.Uuid = uuid.New().String()
me.forge.Patchsets.Patchsets = append(me.forge.Patchsets.Patchsets, fauto) me.forge.Patchsets.Append(fauto)
} }
return fauto return fauto
} }
@ -63,7 +63,7 @@ func addRandomPatch(patch *forgepb.Patch) error {
/* /*
// 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.Set) {
// if the name of the patchset is "forge auto commit" // if the name of the patchset is "forge auto commit"
// then just add all the patches // then just add all the patches
if pb.Name == "forge auto commit" { if pb.Name == "forge auto commit" {
@ -96,8 +96,8 @@ func addPatchset(filename string, pb *forgepb.Patchset) {
} }
// Clone() this protobuf into me.forge.Patchsets // Clone() this protobuf into me.forge.Patchsets
var newpb *forgepb.Patchset var newpb *forgepb.Set
newpb = proto.Clone(pb).(*forgepb.Patchset) newpb = proto.Clone(pb).(*forgepb.Set)
if newpb != nil { if newpb != nil {
me.forge.Patchsets.Patchsets = append(me.forge.Patchsets.Patchsets, newpb) me.forge.Patchsets.Patchsets = append(me.forge.Patchsets.Patchsets, newpb)
} }
@ -122,8 +122,8 @@ func mergePatchsets() {
fmt.Println(entry.Name(), err) fmt.Println(entry.Name(), err)
continue continue
} }
var p *forgepb.Patchset var p *forgepb.Set
p = new(forgepb.Patchset) p = new(forgepb.Set)
err = p.Unmarshal(bytes) err = p.Unmarshal(bytes)
if err != nil { if err != nil {
fmt.Println(entry.Name(), err) fmt.Println(entry.Name(), err)

View File

@ -38,8 +38,8 @@ func sendPendingPatches(pb *forgepb.Patches, reqPB *httppb.HttpRequest) *forgepb
return allPatchesPB return allPatchesPB
} }
func sendPendingPatchsets(pb *forgepb.Patchsets, reqPB *httppb.HttpRequest) *forgepb.Patchsets { func sendPendingPatchsets(pb *forgepb.Sets, reqPB *httppb.HttpRequest) *forgepb.Sets {
allPatchsetsPB := new(forgepb.Patchsets) allPatchsetsPB := new(forgepb.Sets)
for pset := range me.forge.Patchsets.IterAll() { for pset := range me.forge.Patchsets.IterAll() {
allPatchsetsPB.Append(pset) allPatchsetsPB.Append(pset)
} }
@ -54,8 +54,8 @@ func makePatchesPB(reqPB *httppb.HttpRequest) (*forgepb.Patches, error) {
} }
*/ */
func makePatchsetsPB(reqPB *httppb.HttpRequest) (*forgepb.Patchsets, error) { func makePatchsetsPB(reqPB *httppb.HttpRequest) (*forgepb.Sets, error) {
pb := forgepb.NewPatchsets() pb := forgepb.NewSets()
err := pb.Unmarshal(reqPB.ServerData) err := pb.Unmarshal(reqPB.ServerData)
return pb, err return pb, err
} }

View File

@ -100,7 +100,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
if err != nil { if err != nil {
reqPB.Logf("%v", err) reqPB.Logf("%v", err)
} }
result := forgepb.NewPatchsets() result := forgepb.NewSets()
switch route { switch route {
case "/patches/get": case "/patches/get":
result = sendPendingPatchsets(pb, reqPB) result = sendPendingPatchsets(pb, reqPB)