package main import ( "go.wit.com/lib/protobuf/forgepb" "go.wit.com/log" ) func doList() error { log.Info("do list here") // show all the patchsets with Names for pset := range me.forge.Patchsets.IterAll() { log.Info("Info", pset.Name, pset.Uuid) for i, patch := range pset.Patches.Patches { log.Info("\t", i, patch.CommitHash, patch.Namespace) } } return nil } // returns true if the patch already exists in the protobuf func findPatch(newpatch *forgepb.Patch) bool { // log.Info("\tlook for patch:", newpatch.CommitHash, newpatch.Namespace) for pset := range me.forge.Patchsets.IterAll() { for _, patch := range pset.Patches.Patches { if patch.CommitHash == newpatch.CommitHash { // log.Info("\tfound pset!!!!!!", pset.Uuid, patch.Namespace) return true } } } return false } // returns true if the patch already exists in the protobuf func expirePatch(newpatch *forgepb.Patch) bool { // log.Info("\tlook for patch:", newpatch.CommitHash, newpatch.Namespace) for pset := range me.forge.Patchsets.IterAll() { for _, patch := range pset.Patches.Patches { if patch.CommitHash == newpatch.CommitHash { patch.NewHash = newpatch.NewHash // log.Info("\tfound pset!!!!!!", pset.Uuid, patch.Namespace) return true } } } return false }