diff options
Diffstat (limited to 'merge.go')
| -rw-r--r-- | merge.go | 37 |
1 files changed, 21 insertions, 16 deletions
@@ -30,34 +30,35 @@ func (rs *RepoStatus) ResetBranches() bool { func (rs *RepoStatus) FetchMaster() (error, string) { // log.Log(REPOWARN, "FetchMaster() start", rs.Name()) master := rs.GetMasterBranchName() - return rs.fetchBranch(master) + return rs.fetchBranchByName(master) } func (rs *RepoStatus) FetchDevel() (error, string) { devel := rs.GetDevelBranchName() - return rs.fetchBranch(devel) + return rs.fetchBranchByName(devel) } -// fetch the branch 'apple' -func (rs *RepoStatus) fetchBranch(apple string) (error, string) { +// fetch the branch by name +func (rs *RepoStatus) fetchBranchByName(bname string) (error, string) { if rs.GetCurrentBranchName() != rs.GetUserBranchName() { return errors.New("not in user branch"), "" } if rs.gitConfig == nil { return errors.New("missing .git/config"), "" } - log.Log(REPO, rs.Name(), "looking for branch:", apple) + log.Log(REPO, rs.Name(), "looking for branch:", bname) for name, branch := range rs.gitConfig.branches { - if name == apple { + if name == bname { // found the branch! log.Log(REPO, " ", name, "remote:", branch.remote, "merge", branch.merge) - cmd := []string{"git", "fetch", branch.remote, apple + ":" + apple} + cmd := []string{"git", "fetch", branch.remote, bname + ":" + bname} log.Log(REPO, "running:", rs.Name(), cmd) - err, out := rs.RunCmd(cmd) - return err, out + r := rs.Run(cmd) + output := strings.Join(r.Stdout, "\n") + return r.Error, strings.TrimSpace(output) } } - return errors.New("branch " + apple + " not found"), "" + return errors.New("branch " + bname + " not found"), "" } func (rs *RepoStatus) MergeUserToDevel() bool { @@ -383,21 +384,25 @@ func (rs *RepoStatus) generateCmd() bool { } func (rs *RepoStatus) runGitCommands(verbose bool) bool { - for _, line := range rs.versionCmds { + var line []string + for _, line = range rs.versionCmds { s := strings.Join(line, " ") if verbose { log.Log(WARN, "RUNNING:", s) } rs.develMergeB.SetText(s) - err, b, output := runCmd(rs.realPath.String(), line) - if err != nil { + r := rs.Run(line) + output := strings.TrimSpace(strings.Join(r.Stdout, "\n")) + if r.Error != nil { log.Warn("ABEND EXECUTION") - log.Warn("error =", err) + log.Warn("error =", r.Error) log.Warn("output =", output) return false } - log.Log(INFO, "Returned with b =", b) - log.Log(INFO, "output was =", output) + if r.Exit != 0 { + log.Warn("Returned with exit =", r.Exit) + log.Warn("output was =", output) + } log.Log(INFO, "RUN DONE") } return true |
