diff options
Diffstat (limited to 'doPatch.go')
| -rw-r--r-- | doPatch.go | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -34,29 +34,29 @@ func isPatchingSafe() bool { return false } -func doPatch() error { +func doPatch() (string, error) { if argv.Patch.Submit != nil { - return doPatchSubmit() + return "Submitted", doPatchSubmit() } if !isPatchingSafe() { - return log.Errorf("not safe to work on patches") + return "not safe", errors.New("not safe to work on patches") } if argv.Patch.Get != nil { psets := forgepb.NewSets() newpb, _, _ := psets.HttpPostVerbose(myServer(), "get") - doPatchGet(newpb) - return nil + footer, err := doPatchGet(newpb) + return footer, err } if argv.Patch.List != nil { err := doPatchList() - return err + return "listed patches", err } err := doPatchList() - return err + return "listed patches. where is my footer?", err } // submit's current working patches @@ -153,7 +153,7 @@ func applyPatch(repo *gitpb.Repo, p *forgepb.Patch) (string, error) { return p.NewHash, log.Errorf("did not lookup new hash") } -func doPatchGet(newpb *forgepb.Sets) { +func doPatchGet(newpb *forgepb.Sets) (string, error) { // var changed bool curpatches := forgepb.NewPatches() curpatches.Filename = "/tmp/curpatches.pb" @@ -168,7 +168,6 @@ func doPatchGet(newpb *forgepb.Sets) { curpatches.Filename = "/tmp/curpatches.pb" curpatches.Save() } - // newpb.PrintTable() for pset := range newpb.IterAll() { if pset.Patches.Len() == 0 { log.Info("pset is empty", pset.Name) @@ -202,9 +201,8 @@ func doPatchGet(newpb *forgepb.Sets) { } } curpatches.Save() - curpatches.PrintTable() - // me.forge.Patchsets = newpb - // me.forge.Patchsets.Save() + footer := curpatches.PrintTable() + return footer, nil } var ErrorGitPullOnDirty error = errors.New("git comment is not there") |
