diff options
| author | Jeff Carr <[email protected]> | 2025-09-03 20:50:54 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-03 20:50:54 -0500 |
| commit | d6cd7fc88f4bf0bb6069a2ceecef5523fddf836f (patch) | |
| tree | 937eeb5bb8a33e9d28b998f0ee7a2c2384b6e0f0 /patchset.config.go | |
| parent | 50351298b6bc11f1b56916caac7eec506a0d845a (diff) | |
append patches to local patches file
Diffstat (limited to 'patchset.config.go')
| -rw-r--r-- | patchset.config.go | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/patchset.config.go b/patchset.config.go index a151095..ed5853b 100644 --- a/patchset.config.go +++ b/patchset.config.go @@ -84,26 +84,30 @@ func (pb *Patchset) ShowPatchsets() error { } // adds a patchset or just the patches -func (f *Forge) AddPatchset(pb *Patchset) { +func (f *Forge) AddPatchset(pb *Patchset) bool { + var changed bool // if the name of the patchset is "forge auto commit" // then just add all the patches if pb.Name == "forge auto commit" { 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 _, patch := range pb.Patches.Patches { // log.Info("\tnew patch:", i, patch.CommitHash, patch.Namespace) if f.findPatch(patch) { // log.Info("\talready found!!!!!!!", pset.Uuid, patch.Namespace) } else { - log.Info("\tnew patch:", pb.Name, pb.Comment, author) - f.addRandomPatch(patch) + if err := f.addRandomPatch(patch); err == nil { + log.Info("\tnew patch added:", patch.CommitHash, pb.Name, pb.Comment, author) + changed = true + } else { + log.Info("\tnew patch failed:", patch.CommitHash, pb.Name, pb.Comment, author, err) + } + } } - return + return changed } // if you got here, this patchset was submitted with a name @@ -112,7 +116,8 @@ func (f *Forge) AddPatchset(pb *Patchset) { for pset := range f.Patchsets.IterAll() { if pset.Uuid == pb.Uuid { log.Info("ALREADY ADDED", pset.Uuid, pset.Name) - return + return false + } else { } } @@ -122,6 +127,7 @@ func (f *Forge) AddPatchset(pb *Patchset) { if newpb != nil { f.Patchsets.Patchsets = append(f.Patchsets.Patchsets, newpb) } + return true } func (f *Forge) findAutoPatchset() *Patchset { |
