summaryrefslogtreecommitdiff
path: root/patchset.config.go
diff options
context:
space:
mode:
Diffstat (limited to 'patchset.config.go')
-rw-r--r--patchset.config.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/patchset.config.go b/patchset.config.go
index 4f8eedf..6627141 100644
--- a/patchset.config.go
+++ b/patchset.config.go
@@ -32,6 +32,19 @@ func (f *Forge) LoadPatchsets() error {
return nil
}
+func (f *Forge) InitPatchsets() error {
+ if err := f.LoadPatchsets(); err == nil {
+ return nil
+ } else {
+ log.Info("LoadPatchsets() failed", err)
+ }
+ // TODO: check if Unmarshal failed here
+ f.Patchsets = NewPatchsets()
+ tmp := f.findAutoPatchset() // makes the default setting
+ f.Patchsets.Append(tmp)
+ return f.SavePatchsets()
+}
+
func (f *Forge) SavePatchsets() error {
filename := filepath.Join(f.patchDir, "all-patches.pb")
regfile, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)