diff options
| author | Jeff Carr <[email protected]> | 2025-09-23 07:44:07 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-23 07:44:07 -0500 |
| commit | 81fc15e743f0c2acfbf2520a9ed2bfbcba431b12 (patch) | |
| tree | 931e5a37bd3b5e1868d66b5e492cdd7d83c63c42 /patchset.config.go | |
| parent | 6bfd8c78abf12a6a7a8e7d0932f5160b9abc95e1 (diff) | |
less confusing patch .proto files
Diffstat (limited to 'patchset.config.go')
| -rw-r--r-- | patchset.config.go | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/patchset.config.go b/patchset.config.go index a156521..3762d55 100644 --- a/patchset.config.go +++ b/patchset.config.go @@ -14,7 +14,7 @@ import ( ) func (f *Forge) LoadPatchsets() error { - f.Patchsets = NewPatchsets() + f.Patchsets = NewSets() filename := filepath.Join(f.Config.PatchDir, "all-patches.pb") @@ -39,7 +39,7 @@ func (f *Forge) InitPatchsets() error { log.Info("LoadPatchsets() failed", err) } // TODO: check if Unmarshal failed here - f.Patchsets = NewPatchsets() + f.Patchsets = NewSets() f.findAutoPatchset() // adds the default values return f.SavePatchsets() } @@ -54,7 +54,7 @@ func (f *Forge) SavePatchsets() error { } defer regfile.Close() - newpb := proto.Clone(f.Patchsets).(*Patchsets) + newpb := proto.Clone(f.Patchsets).(*Sets) if newpb == nil { for pset := range f.Patchsets.IterAll() { pset.ShowPatchsets() @@ -79,7 +79,7 @@ func cleanSubject(line string) string { return strings.TrimSpace(cleaned) } -func (pb *Patchset) ShowPatchsets() error { +func (pb *Set) ShowPatchsets() 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) @@ -109,7 +109,7 @@ func (f *Forge) AddPatch(patch *Patch) bool { } // adds a patchset or just the patches -func (f *Forge) AddPatchset(pb *Patchset) bool { +func (f *Forge) AddPatchset(pb *Set) bool { var changed bool // if the name of the patchset is "forge auto commit" // then just add all the patches @@ -146,23 +146,18 @@ func (f *Forge) AddPatchset(pb *Patchset) bool { } } - // Clone() this protobuf into me.forge.Patchsets - var newpb *Patchset - newpb = proto.Clone(pb).(*Patchset) - if newpb != nil { - f.Patchsets.Patchsets = append(f.Patchsets.Patchsets, newpb) - } + f.Patchsets.Append(pb) return true } -func (f *Forge) findAutoPatchset() *Patchset { +func (f *Forge) findAutoPatchset() *Set { for pset := range f.Patchsets.IterAll() { if pset.Name == "forge auto commit" { return pset } } - var fauto *Patchset + var fauto *Set log.Warn("findAutoPatchset() had to create 'forge auto commit'") if fauto == nil { fauto = makeDefaultPatchset() @@ -171,8 +166,8 @@ func (f *Forge) findAutoPatchset() *Patchset { return fauto } -func makeDefaultPatchset() *Patchset { - fauto := new(Patchset) +func makeDefaultPatchset() *Set { + fauto := new(Set) fauto.Name = "forge auto commit" fauto.Patches = NewPatches() fauto.Uuid = uuid.New().String() |
