diff --git a/draw.go b/draw.go index ea72ea0..80e3743 100644 --- a/draw.go +++ b/draw.go @@ -251,6 +251,10 @@ func (rs *RepoStatus) recommend() { if rs.develBranchVersion.Get() != rs.jcarrBranchVersion.Get() { log.Warn("devel does not equal jcarr") log.Warn("merge or squash?") + rs.EnableMergeDevel() + rs.setMergeUserCommands() + label := "merge " + rs.GetUserName() + " into " + rs.GetDevelName() + rs.develMerge.SetText(label) return } log.Warn("Does master == devel? ", rs.masterBranchVersion.Get(), rs.develBranchVersion.Get()) @@ -258,6 +262,8 @@ func (rs *RepoStatus) recommend() { log.Warn("master does not equal devel. merge devel into master") rs.EnableMergeDevel() rs.setMergeDevelCommands() + label := "merge " + rs.GetDevelName() + " into " + rs.GetMasterName() + rs.develMerge.SetText(label) return } rs.getLastTagVersion() @@ -345,13 +351,45 @@ func (rs *RepoStatus) setGitCommands() { } func (rs *RepoStatus) setMergeDevelCommands() { - var line1, line2 []string + var line1, line2, line3 []string var all [][]string - line1 = append(line1, "git", "merge", "devel") + master := rs.GetMasterName() + devel := rs.GetDevelName() + + line1 = append(line1, "git", "checkout", master) all = append(all, line1) - line2 = append(line2, "git", "push") + line2 = append(line2, "git", "merge", devel) all = append(all, line2) + line3 = append(line3, "git", "push") + all = append(all, line3) + + rs.versionCmds = all + + var tmp []string + // convert to displayable to the user text + for _, line := range all { + s := strings.Join(line, " ") + log.Warn("s =", s) + tmp = append(tmp, s) + } + + rs.versionCmdOutput.Set(strings.Join(tmp, "\n")) +} + +func (rs *RepoStatus) setMergeUserCommands() { + var line1, line2, line3 []string + var all [][]string + + devel := rs.GetDevelName() + user := rs.GetUserName() + + line1 = append(line1, "git", "checkout", devel) + all = append(all, line1) + line2 = append(line2, "git", "merge", user) + all = append(all, line2) + line3 = append(line3, "git", "push") + all = append(all, line3) rs.versionCmds = all