move merge code to gitpb
This commit is contained in:
parent
3a53e0bd9b
commit
05d827868e
136
merge.go
136
merge.go
|
@ -59,104 +59,16 @@ func (rs *RepoStatus) fetchBranchByName(bname string) (error, string) {
|
||||||
return errors.New("branch " + bname + " not found"), ""
|
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 {
|
func (rs *RepoStatus) runFullAutomation() bool {
|
||||||
if !rs.MergeUserToDevel() {
|
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())
|
|
||||||
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
|
return true
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
var releaseRevision string = ""
|
var releaseRevision string = ""
|
||||||
|
|
||||||
|
@ -508,3 +420,49 @@ func (rs *RepoStatus) IsCorrectMode(mode string) bool {
|
||||||
}
|
}
|
||||||
return false
|
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
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
10
modifyBox.go
10
modifyBox.go
|
@ -47,10 +47,10 @@ 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.MergeUserToDevel() {
|
if result, err := rs.pb.MergeUserToDevel(); err == nil {
|
||||||
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", result.Error)
|
||||||
}
|
}
|
||||||
rs.Enable()
|
rs.Enable()
|
||||||
})
|
})
|
||||||
|
@ -58,10 +58,10 @@ 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.MergeDevelToMaster() {
|
if result, err := rs.pb.MergeDevelToMaster(); err == nil {
|
||||||
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", result.Error)
|
||||||
}
|
}
|
||||||
rs.Enable()
|
rs.Enable()
|
||||||
})
|
})
|
||||||
|
@ -112,7 +112,7 @@ func (rs *RepoStatus) drawGitCommands(box *gui.Node) {
|
||||||
|
|
||||||
rs.releaseVersion = newgrid.NewButton("tag and release new version", func() {
|
rs.releaseVersion = newgrid.NewButton("tag and release new version", func() {
|
||||||
rs.Disable()
|
rs.Disable()
|
||||||
rs.MergeDevelToMaster()
|
rs.pb.MergeDevelToMaster()
|
||||||
})
|
})
|
||||||
// rs.releaseVersion.Hide()
|
// rs.releaseVersion.Hide()
|
||||||
newgrid.NextRow()
|
newgrid.NextRow()
|
||||||
|
|
Loading…
Reference in New Issue