redo the merge code

This commit is contained in:
Jeff Carr 2024-02-16 21:20:52 -06:00
parent c7aaea4ae1
commit f82743d487
4 changed files with 41 additions and 27 deletions

2
git.go
View File

@ -421,7 +421,7 @@ func (rs *RepoStatus) GetStatus() string {
return "merge to main" return "merge to main"
} }
if rs.lasttag.String() != rs.GetMasterVersion() { if rs.lasttag.String() != rs.GetMasterVersion() {
return "ready to tag version" return "unchanged"
} }
if rs.CheckBranches() { if rs.CheckBranches() {

View File

@ -8,26 +8,38 @@ import (
"go.wit.com/widget" "go.wit.com/widget"
) )
func (rs *RepoStatus) RunDevelMergeB() bool { func (rs *RepoStatus) MergeUserToDevel() bool {
startbranch := rs.GetCurrentBranchName() startbranch := rs.GetCurrentBranchName()
master := rs.mainWorkingName.String() /*
log.Warn("RunDevelMergeB() checking out master branch", master) devel := rs.GetDevelBranchName()
rs.CheckoutBranch(master) if ! rs.CheckoutBranch(devel) {
log.Warn("MergeUserToDevel() devel checkout failed", devel)
return false
}
newbranch := rs.GetCurrentBranchName() newbranch := rs.GetCurrentBranchName()
if newbranch != master { if newbranch != devel {
log.Warn("RunDevelMergeB() something went wrong switching branch:", master) log.Warn("MergeUserToDevel() devel checkout failed", devel)
log.Warn("RunDevelMergeB() start working name =", startbranch)
log.Warn("RunDevelMergeB() current working name =", newbranch)
return false return false
} }
log.Warn("RunDevelMergeB() running runGitCommands()") */
if !rs.runGitCommands(true) { devel := rs.GetDevelBranchName()
log.Warn("RunDevelMergeB() SOMETHING WENT WRONG") user := rs.GetUserBranchName()
return false
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() rs.UpdateNew()
log.Warn("RunDevelMergeB() THINGS SEEM OK runGitCommands() returned true.") return false
return true
} }
func (rs *RepoStatus) runReleaseVersionB() bool { func (rs *RepoStatus) runReleaseVersionB() bool {
@ -49,11 +61,12 @@ func (rs *RepoStatus) runReleaseVersionB() bool {
} }
func (rs *RepoStatus) runFullAutomation() bool { func (rs *RepoStatus) runFullAutomation() bool {
if !rs.RunDevelMergeB() { if !rs.MergeUserToDevel() {
log.Warn("THINGS FAILED returned false") log.Warn("THINGS FAILED returned false")
return false return false
} }
log.Warn("THINGS SEEM OK returned true. can run this again?") log.Warn("THINGS SEEM OK returned true. can run this again?")
/*
log.Warn("develMerge =", rs.develMergeB.String()) log.Warn("develMerge =", rs.develMergeB.String())
label := "merge devel into " + rs.GetMasterBranchName() label := "merge devel into " + rs.GetMasterBranchName()
if label == rs.develMergeB.String() { if label == rs.develMergeB.String() {
@ -63,6 +76,7 @@ func (rs *RepoStatus) runFullAutomation() bool {
return false return false
} }
} }
*/
if rs.develMergeB.String() == "ready to release" { if rs.develMergeB.String() == "ready to release" {
log.Warn("THINGS SEEM OK ready to release") log.Warn("THINGS SEEM OK ready to release")
if rs.releaseVersion.String() == "Release!" { if rs.releaseVersion.String() == "Release!" {

View File

@ -50,7 +50,7 @@ func (rs *RepoStatus) drawGitCommands(box *gui.Node) {
label := "merge " + rs.userWorkingName.String() + " to " + rs.develWorkingName.String() label := "merge " + rs.userWorkingName.String() + " to " + rs.develWorkingName.String()
rs.develMergeB = newgrid.NewButton(label, func() { rs.develMergeB = newgrid.NewButton(label, func() {
rs.Disable() rs.Disable()
if rs.RunDevelMergeB() { if rs.MergeUserToDevel() {
log.Warn("THINGS SEEM OK fullAutomation() returned true.") log.Warn("THINGS SEEM OK fullAutomation() returned true.")
} else { } else {
log.Warn("THINGS FAILED fullAutomation() returned false") log.Warn("THINGS FAILED fullAutomation() returned false")
@ -61,7 +61,7 @@ func (rs *RepoStatus) drawGitCommands(box *gui.Node) {
label = "merge " + rs.develWorkingName.String() + " to " + rs.mainWorkingName.String() label = "merge " + rs.develWorkingName.String() + " to " + rs.mainWorkingName.String()
rs.mainMergeB = newgrid.NewButton(label, func() { rs.mainMergeB = newgrid.NewButton(label, func() {
rs.Disable() rs.Disable()
if rs.RunDevelMergeB() { if rs.MergeUserToDevel() {
log.Warn("THINGS SEEM OK fullAutomation() returned true.") log.Warn("THINGS SEEM OK fullAutomation() returned true.")
} else { } else {
log.Warn("THINGS FAILED fullAutomation() returned false") log.Warn("THINGS FAILED fullAutomation() returned false")

18
unix.go
View File

@ -416,23 +416,23 @@ func (rs *RepoStatus) XtermBash(args []string) {
path := rs.realPath.String() path := rs.realPath.String()
cmd.Dir = path cmd.Dir = path
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
log.Info("xterm.Run() failed") log.Log(WARN, "xterm.Run() failed")
log.Info("path =", path) log.Log(WARN, "path =", path)
log.Info("cmd = xterm", argsX) log.Log(WARN, "cmd = xterm", argsX)
} else { } else {
log.Info("xterm.Run() worked") log.Log(WARN, "xterm.Run() worked")
log.Info("path =", path) log.Log(WARN, "path =", path)
log.Info("cmd = xterm", argsX) log.Log(WARN, "cmd = xterm", argsX)
} }
} }
func (rs *RepoStatus) DoAll(all [][]string) bool { func (rs *RepoStatus) DoAll(all [][]string) bool {
for _, cmd := range all { for _, cmd := range all {
log.Info("doAll() RUNNING: cmd =", cmd) log.Log(WARN, "doAll() RUNNING: cmd =", cmd)
err, out := rs.RunCmd(cmd) err, out := rs.RunCmd(cmd)
log.Info("doAll() err =", err)
log.Info("doAll() out =", out)
if err != nil { if err != nil {
log.Log(WARN, "doAll() err =", err)
log.Log(WARN, "doAll() out =", out)
return false return false
} }
} }