summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doCommit.go13
-rw-r--r--doPatch.go21
2 files changed, 18 insertions, 16 deletions
diff --git a/doCommit.go b/doCommit.go
index 5539c54..9a24263 100644
--- a/doCommit.go
+++ b/doCommit.go
@@ -4,12 +4,14 @@
package main
import (
+ "errors"
+
"go.wit.com/lib/config"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
-func doCommit() error {
+func doCommit() (string, error) {
if argv.Commit.All || argv.All {
found := me.forge.CheckDirty()
var newpatches bool
@@ -25,7 +27,7 @@ func doCommit() error {
config.SetChanged("repos", true)
return doPatchSubmit()
}
- okExit("")
+ return "git ommit --all done", nil
}
repo := findCurrentPwdRepoOrDie()
@@ -39,15 +41,16 @@ func doCommit() error {
if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
found := new(gitpb.Repos)
found.Append(repo)
- me.forge.PrintHumanTable(found)
+ footer := me.forge.PrintHumanTable(found)
+ log.Info(footer)
log.Info("")
log.Info("wrong branch. Can not commit on", repo.GetCurrentBranchName())
log.Info("")
- okExit("")
+ return "repo must be on user branch", errors.New("repo must be on user branch")
}
if err := repo.GitCommit(); err != nil {
- badExit(err)
+ return "git commit --all", err
}
return doPatchSubmit()
diff --git a/doPatch.go b/doPatch.go
index b47e336..ff9f8fb 100644
--- a/doPatch.go
+++ b/doPatch.go
@@ -36,7 +36,7 @@ func isPatchingSafe() bool {
func doPatch() (string, error) {
if argv.Patch.Submit {
- return "Submitted", doPatchSubmit()
+ return doPatchSubmit()
}
if !isPatchingSafe() {
@@ -55,22 +55,20 @@ func doPatch() (string, error) {
}
// submit's current working patches
-func doPatchSubmit() error {
+func doPatchSubmit() (string, error) {
pset, err := me.forge.MakeDevelPatchSet("testing")
if err != nil {
- return err
+ return "MakeDevelPatchSet(testing)", err
}
if pset.Patches == nil {
- log.Info("pset.Patches == nil")
- return err
+ return "pset.Patches == nil", err
}
if pset.Patches.Len() == 0 {
- log.Info("did not find any patches")
- return nil
+ return "did not find any patches", nil
}
- pset.PrintTable()
+ footer := pset.PrintTable()
_, _, err = pset.HttpPost(myServer(), "new")
- return err
+ return footer, err
}
func doPatchList() (string, error) {
@@ -79,7 +77,8 @@ func doPatchList() (string, error) {
if err := curpatches.Load(); err != nil {
return "fix curpatches.pb", err
}
- curpatches.PrintTable()
+ footer := curpatches.PrintTable()
+ log.Info("curpatches:", footer)
var needfix int
for patch := range curpatches.IterAll() {
repo := me.forge.Repos.FindByNamespace(patch.Namespace)
@@ -115,7 +114,7 @@ func doPatchList() (string, error) {
// newNewId, err := searchAllCommits(targetPatchID string) (string, error) {
}
}
- log.Info(patch.PatchId, newId, "new patch", patch.Comment)
+ log.Info(patch.PatchId, newId, repo.Namespace, "new patch", patch.Comment)
if !argv.Fix {
needfix += 1
} else {