diff --git a/merge.go b/merge.go index d735d15..cda174b 100644 --- a/merge.go +++ b/merge.go @@ -59,104 +59,16 @@ func (rs *RepoStatus) fetchBranchByName(bname string) (error, string) { return errors.New("branch " + bname + " not found"), "" } -func (rs *RepoStatus) MergeUserToDevel() bool { - startbranch := rs.GetCurrentBranchName() - devel := rs.GetDevelBranchName() - user := rs.GetUserBranchName() - - log.Info("MergeUserToDevel() checking out", devel, "started on", startbranch, "merge", user) - - var all [][]string - all = append(all, []string{"git", "checkout", devel}) - all = append(all, []string{"git", "merge", user}) - all = append(all, []string{"git", "push"}) - - if rs.DoAll(all) { - log.Log(WARN, "MergeUserToDevel() failed", rs.Path()) - rs.updateNew() - return true - } - // DoAll failed - rs.updateNew() - return false -} - -func (rs *RepoStatus) MergeDevelToMaster() bool { - startbranch := rs.GetCurrentBranchName() - devel := rs.GetDevelBranchName() - main := rs.GetMasterBranchName() - - log.Info("MergeDevelToMaster() checking out", main, "started on", startbranch, "merge", devel) - - var all [][]string - all = append(all, []string{"git", "checkout", main}) - all = append(all, []string{"git", "merge", devel}) - all = append(all, []string{"git", "push"}) - - if rs.DoAll(all) { - log.Log(WARN, "MergeDevelToMaster() failed", rs.Path()) - rs.updateNew() - return true - } - // DoAll failed - rs.updateNew() - return false -} - /* -func (rs *RepoStatus) runReleaseVersionB() bool { - if !rs.generateCmd() { - log.Warn("something is wrong. fix the errors first") - return false - } - rs.releaseVersion.Disable() - log.Warn("MAKING A RELEASE AND VERSION") - if !rs.runGitCommands(true) { - log.Warn("SOMETHING WENT WRONG") - rs.UpdateNew() - rs.Enable() - return false - } - log.Warn("THINGS SEEM OK. runReleaseVersionB worked. Release is finished. restart autotypist()") - rs.Hide() - return true -} -*/ - func (rs *RepoStatus) runFullAutomation() bool { if !rs.MergeUserToDevel() { log.Warn("THINGS FAILED returned false") return false } log.Warn("THINGS SEEM OK returned true. can run this again?") - /* - log.Warn("develMerge =", rs.develMergeB.String()) - label := "merge devel into " + rs.GetMasterBranchName() - if label == rs.develMergeB.String() { - log.Warn("LABELS MATCH", label, rs.develMergeB.String()) - if !rs.RunDevelMergeB() { - log.Warn("THINGS FAILED returned false") - return false - } - } - if rs.develMergeB.String() == "ready to release" { - log.Warn("THINGS SEEM OK ready to release") - if rs.releaseVersion.String() == "Release!" { - log.Warn("releaseVersion == 'Release!'. safe to do release version HERE?") - log.Warn("rs.newversion =", rs.newversion.String()) - log.Warn("rs.targetReleaseVersion =", rs.targetReleaseVersion.String()) - log.Warn("Are these equal?") - if rs.newversion.String() == rs.targetReleaseVersion.String() { - log.Warn("THEY ARE EQUAL!") - rs.runReleaseVersionB() - } else { - log.Warn("THEY ARE NOT EQUAL") - } - } - } - */ return true } +*/ var releaseRevision string = "" @@ -508,3 +420,49 @@ func (rs *RepoStatus) IsCorrectMode(mode string) bool { } return false } + +/* moved to gitpb +func (rs *RepoStatus) MergeUserToDevel() bool { + startbranch := rs.GetCurrentBranchName() + devel := rs.GetDevelBranchName() + user := rs.GetUserBranchName() + + log.Info("MergeUserToDevel() checking out", devel, "started on", startbranch, "merge", user) + + var all [][]string + all = append(all, []string{"git", "checkout", devel}) + all = append(all, []string{"git", "merge", user}) + all = append(all, []string{"git", "push"}) + + if rs.DoAll(all) { + log.Log(WARN, "MergeUserToDevel() failed", rs.Path()) + rs.updateNew() + return true + } + // DoAll failed + rs.updateNew() + return false +} + +func (rs *RepoStatus) MergeDevelToMaster() bool { + startbranch := rs.GetCurrentBranchName() + devel := rs.GetDevelBranchName() + main := rs.GetMasterBranchName() + + log.Info("MergeDevelToMaster() checking out", main, "started on", startbranch, "merge", devel) + + var all [][]string + all = append(all, []string{"git", "checkout", main}) + all = append(all, []string{"git", "merge", devel}) + all = append(all, []string{"git", "push"}) + + if rs.DoAll(all) { + log.Log(WARN, "MergeDevelToMaster() failed", rs.Path()) + rs.updateNew() + return true + } + // DoAll failed + rs.updateNew() + return false +} +*/ diff --git a/modifyBox.go b/modifyBox.go index 644fcda..6003fae 100644 --- a/modifyBox.go +++ b/modifyBox.go @@ -47,10 +47,10 @@ func (rs *RepoStatus) drawGitCommands(box *gui.Node) { label := "merge " + rs.userWorkingName.String() + " to " + rs.develWorkingName.String() rs.develMergeB = newgrid.NewButton(label, func() { rs.Disable() - if rs.MergeUserToDevel() { + if result, err := rs.pb.MergeUserToDevel(); err == nil { log.Warn("THINGS SEEM OK fullAutomation() returned true.") } else { - log.Warn("THINGS FAILED fullAutomation() returned false") + log.Warn("THINGS FAILED fullAutomation() returned false", result.Error) } rs.Enable() }) @@ -58,10 +58,10 @@ func (rs *RepoStatus) drawGitCommands(box *gui.Node) { label = "merge " + rs.develWorkingName.String() + " to " + rs.mainWorkingName.String() rs.mainMergeB = newgrid.NewButton(label, func() { rs.Disable() - if rs.MergeDevelToMaster() { + if result, err := rs.pb.MergeDevelToMaster(); err == nil { log.Warn("THINGS SEEM OK fullAutomation() returned true.") } else { - log.Warn("THINGS FAILED fullAutomation() returned false") + log.Warn("THINGS FAILED fullAutomation() returned false", result.Error) } rs.Enable() }) @@ -112,7 +112,7 @@ func (rs *RepoStatus) drawGitCommands(box *gui.Node) { rs.releaseVersion = newgrid.NewButton("tag and release new version", func() { rs.Disable() - rs.MergeDevelToMaster() + rs.pb.MergeDevelToMaster() }) // rs.releaseVersion.Hide() newgrid.NextRow()