diff options
| author | Jeff Carr <[email protected]> | 2025-08-28 16:28:48 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-08-28 19:30:59 -0500 |
| commit | 86ac85dd5b5432ca3d1ff935b6ff6582ba37c287 (patch) | |
| tree | b781c9f970f153a191353ee1192b12ac9b082d25 /doList.go | |
| parent | 684c5b1dad1ebaa6a9443641e65e2789c3c85911 (diff) | |
update auto complete. merge is smarter
Diffstat (limited to 'doList.go')
| -rw-r--r-- | doList.go | 31 |
1 files changed, 24 insertions, 7 deletions
@@ -1,7 +1,8 @@ package main import ( - "fmt" + "regexp" + "strings" "go.wit.com/lib/protobuf/forgepb" "go.wit.com/log" @@ -14,21 +15,37 @@ func doList() error { badExit(err) } + // first show the general patchset protobuf + for pb := range me.all.IterAll() { + if pb.Name == "forge auto commit" { + showPatchsets(pb) + } + } + + // show all the patchsets with Names for pset := range me.all.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 + ">" - - // author := "Author: " + os.Getenv("GIT_AUTHOR_NAME") - // author += " <" + os.Getenv("GIT_AUTHOR_EMAIL") + ">" - fmt.Println(pb.Name, pb.Comment, author) - for i, patches := range pb.Patches.Patches { - log.Info("\tnew patches:", i, patches.CommitHash, patches.Namespace) + 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) } /* for patch := range pb.IterAll() { |
