diff options
Diffstat (limited to 'doPatch.go')
| -rw-r--r-- | doPatch.go | 39 |
1 files changed, 29 insertions, 10 deletions
@@ -10,14 +10,19 @@ import ( "go.wit.com/log" ) -func doPatch() error { +func doPatchInit() { + if me.forge.Patchsets != nil { + log.Info("IGNORE: patches already initalized") + } if err := me.forge.LoadPatchsets(); err != nil { log.Info("patches failed to open", err) if err := me.forge.SavePatchsets(); err != nil { log.Warn("savePatchsets() failed", err) } } +} +func doPatch() error { if argv.Patch.Submit != nil { _, err := me.forge.SubmitDevelPatchSet(argv.Patch.Submit.Match) if err != nil { @@ -43,21 +48,35 @@ func doPatch() error { } if argv.Patch.Check != nil { + log.Info("remove this option") + return nil + } + + if argv.Patch.List != nil { + var changed bool for pset := range me.forge.Patchsets.IterAll() { log.Info(pset.Uuid) for patch := range pset.Patches.IterAll() { - if repo, ok := me.forge.IsPatchApplied(patch); ok { - log.Info("found patch in repo", repo.Namespace, patch.Filename) - } else { - // log.Info("did not find patch", patch.CommitHash, patch.NewHash, patch.Filename) + if setNewCommitHash(patch) { + changed = true } } - } - // me.forge.Patchsets.PrintTable() - return nil - } - if argv.Patch.List != nil { + /* + for patch := range pset.Patches.IterAll() { + if repo, ok := me.forge.IsPatchApplied(patch); ok { + log.Info("\tfound patch in repo", repo.Namespace, patch.Filename) + } else { + log.Info("\tdid not find patch", patch.CommitHash, patch.NewHash, patch.Filename) + } + } + */ + } + if changed { + if err := me.forge.SavePatchsets(); err != nil { + log.Warn("savePatchsets() failed", err) + } + } me.forge.Patchsets.PrintTable() // return doPatchList() return nil |
