summaryrefslogtreecommitdiff
path: root/doList.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-08-28 18:56:27 -0500
committerJeff Carr <[email protected]>2025-08-28 19:30:59 -0500
commit22f823bebe66ea758cf9bb4b72087b167a14d288 (patch)
tree8fd156cadaf49115b806bfb1144a3b6a534300e3 /doList.go
parent250fa7de4a714c0457a4eda6d0c4c4b88b6c0821 (diff)
move common patches code to forgepb
Diffstat (limited to 'doList.go')
-rw-r--r--doList.go39
1 files changed, 6 insertions, 33 deletions
diff --git a/doList.go b/doList.go
index ce4f6ac..382c083 100644
--- a/doList.go
+++ b/doList.go
@@ -1,9 +1,6 @@
package main
import (
- "regexp"
- "strings"
-
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/log"
)
@@ -11,48 +8,24 @@ import (
func doList() error {
log.Info("do list here")
- if err := LoadPatchsets(); err != nil {
+ if err := me.forge.LoadPatchsets(); err != nil {
badExit(err)
}
// first show the general patchset protobuf
- for pb := range me.all.IterAll() {
+ for pb := range me.forge.Patchsets.IterAll() {
if pb.Name == "forge auto commit" {
- showPatchsets(pb)
+ pb.ShowPatchsets()
}
}
// show all the patchsets with Names
- for pset := range me.all.IterAll() {
+ for pset := range me.forge.Patchsets.IterAll() {
if pset.Name == "forge auto commit" {
continue
}
- showPatchsets(pset)
- }
- return nil
-}
-
-func cleanSubject(line string) string {
- // Regular expression to remove "Subject:" and "[PATCH...]" patterns
- re := regexp.MustCompile(`(?i)^Subject:\s*(\[\s*PATCH[^\]]*\]\s*)?`)
- cleaned := re.ReplaceAllString(line, "")
- return strings.TrimSpace(cleaned)
-}
-
-func showPatchsets(pb *forgepb.Patchset) error {
- author := "Author: " + pb.GitAuthorName
- author += " <" + pb.GitAuthorEmail + ">"
- log.Printf("%-16s %s %s %s\n", string(pb.Uuid)[0:8], pb.Name, pb.Comment, author)
- for _, patch := range pb.Patches.Patches {
- comment := cleanSubject(patch.Comment)
- log.Printf("\t%-8s %-50s %-50s\n", string(patch.CommitHash)[0:8], patch.Namespace, comment)
+ pset.ShowPatchsets()
}
- /*
- for patch := range pb.IterAll() {
- comment := cleanSubject(patch.Comment)
- log.Info("\tnew patch:", patch.NewHash, "commithash:", patch.CommitHash, patch.Namespace, comment)
- }
- */
return nil
}
@@ -60,7 +33,7 @@ func showPatchsets(pb *forgepb.Patchset) error {
func findPatch(newpatch *forgepb.Patch) bool {
// log.Info("\tlook for patch:", newpatch.CommitHash, newpatch.Namespace)
- for pset := range me.all.IterAll() {
+ 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)