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"
}
if rs.lasttag.String() != rs.GetMasterVersion() {
return "ready to tag version"
return "unchanged"
}
if rs.CheckBranches() {

View File

@ -8,26 +8,38 @@ import (
"go.wit.com/widget"
)
func (rs *RepoStatus) RunDevelMergeB() bool {
func (rs *RepoStatus) MergeUserToDevel() bool {
startbranch := rs.GetCurrentBranchName()
master := rs.mainWorkingName.String()
log.Warn("RunDevelMergeB() checking out master branch", master)
rs.CheckoutBranch(master)
/*
devel := rs.GetDevelBranchName()
if ! rs.CheckoutBranch(devel) {
log.Warn("MergeUserToDevel() devel checkout failed", devel)
return false
}
newbranch := rs.GetCurrentBranchName()
if newbranch != master {
log.Warn("RunDevelMergeB() something went wrong switching branch:", master)
log.Warn("RunDevelMergeB() start working name =", startbranch)
log.Warn("RunDevelMergeB() current working name =", newbranch)
if newbranch != devel {
log.Warn("MergeUserToDevel() devel checkout failed", devel)
return false
}
log.Warn("RunDevelMergeB() running runGitCommands()")
if !rs.runGitCommands(true) {
log.Warn("RunDevelMergeB() SOMETHING WENT WRONG")
return false
*/
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()
log.Warn("RunDevelMergeB() THINGS SEEM OK runGitCommands() returned true.")
return true
return false
}
func (rs *RepoStatus) runReleaseVersionB() bool {
@ -49,11 +61,12 @@ func (rs *RepoStatus) runReleaseVersionB() bool {
}
func (rs *RepoStatus) runFullAutomation() bool {
if !rs.RunDevelMergeB() {
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() {
@ -63,6 +76,7 @@ func (rs *RepoStatus) runFullAutomation() bool {
return false
}
}
*/
if rs.develMergeB.String() == "ready to release" {
log.Warn("THINGS SEEM OK ready to 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()
rs.develMergeB = newgrid.NewButton(label, func() {
rs.Disable()
if rs.RunDevelMergeB() {
if rs.MergeUserToDevel() {
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
} else {
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()
rs.mainMergeB = newgrid.NewButton(label, func() {
rs.Disable()
if rs.RunDevelMergeB() {
if rs.MergeUserToDevel() {
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
} else {
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()
cmd.Dir = path
if err := cmd.Run(); err != nil {
log.Info("xterm.Run() failed")
log.Info("path =", path)
log.Info("cmd = xterm", argsX)
log.Log(WARN, "xterm.Run() failed")
log.Log(WARN, "path =", path)
log.Log(WARN, "cmd = xterm", argsX)
} else {
log.Info("xterm.Run() worked")
log.Info("path =", path)
log.Info("cmd = xterm", argsX)
log.Log(WARN, "xterm.Run() worked")
log.Log(WARN, "path =", path)
log.Log(WARN, "cmd = xterm", argsX)
}
}
func (rs *RepoStatus) DoAll(all [][]string) bool {
for _, cmd := range all {
log.Info("doAll() RUNNING: cmd =", cmd)
log.Log(WARN, "doAll() RUNNING: cmd =", cmd)
err, out := rs.RunCmd(cmd)
log.Info("doAll() err =", err)
log.Info("doAll() out =", out)
if err != nil {
log.Log(WARN, "doAll() err =", err)
log.Log(WARN, "doAll() out =", out)
return false
}
}