more overall checking for branch changes
This commit is contained in:
parent
2c7e15ccfa
commit
6ded56a13a
47
doCommon.go
47
doCommon.go
|
@ -4,6 +4,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.wit.com/lib/gui/shell"
|
"go.wit.com/lib/gui/shell"
|
||||||
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
@ -55,15 +56,34 @@ func doCheckDirtyAndConfigSave() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsEverythingOnDevel() bool {
|
func IsEverythingOnDevel() bool {
|
||||||
|
me.found = new(gitpb.Repos)
|
||||||
all := me.forge.Repos.SortByFullPath()
|
all := me.forge.Repos.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
if repo.GetCurrentBranchName() != repo.GetDevelBranchName() {
|
if repo.GetCurrentBranchName() != repo.GetDevelBranchName() {
|
||||||
log.Info(repo.GetFullPath(), repo.GetCurrentBranchName(), repo.GetDevelBranchName())
|
// log.Info(repo.GetFullPath(), repo.GetCurrentBranchName(), repo.GetDevelBranchName())
|
||||||
return false
|
me.found.AppendUniqueGoPath(repo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if len(me.found.Repos) == 0 {
|
||||||
return true
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func IsEverythingOnUser() bool {
|
||||||
|
me.found = new(gitpb.Repos)
|
||||||
|
all := me.forge.Repos.SortByFullPath()
|
||||||
|
for all.Scan() {
|
||||||
|
repo := all.Next()
|
||||||
|
if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
|
||||||
|
me.found.AppendUniqueGoPath(repo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(me.found.Repos) == 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func doGitReset() {
|
func doGitReset() {
|
||||||
|
@ -101,3 +121,26 @@ func checkoutBranches(repo *gitpb.Repo) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func doAllCheckoutDevel() bool {
|
||||||
|
me.forge.CheckoutDevel()
|
||||||
|
me.forge = forgepb.Init()
|
||||||
|
if !IsEverythingOnDevel() {
|
||||||
|
log.Info("switching to devel branch failed")
|
||||||
|
doCobol()
|
||||||
|
badExit(nil)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func doAllCheckoutUser() bool {
|
||||||
|
me.forge.CheckoutUser()
|
||||||
|
me.forge = forgepb.Init()
|
||||||
|
if !IsEverythingOnUser() {
|
||||||
|
log.Info("switching to user branch failed")
|
||||||
|
doCobol()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
|
@ -84,12 +84,32 @@ func globalBuildOptions(vbox *gui.Node) {
|
||||||
me.setBranchB = grid.NewButton("set current branch to:", func() {
|
me.setBranchB = grid.NewButton("set current branch to:", func() {
|
||||||
targetName := me.newBranch.String()
|
targetName := me.newBranch.String()
|
||||||
log.Warn("setting all branches to", targetName)
|
log.Warn("setting all branches to", targetName)
|
||||||
|
if targetName == "devel" {
|
||||||
|
if !doAllCheckoutDevel() {
|
||||||
|
okExit("")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if targetName == "master" {
|
||||||
|
log.Info("Don't know how to set", targetName, "yet")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// just assume user
|
||||||
|
if targetName == "jcarr" {
|
||||||
|
if doAllCheckoutUser() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Info("switching to user branches failed")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
/*
|
||||||
loop := me.repos.View.ReposSortByName()
|
loop := me.repos.View.ReposSortByName()
|
||||||
for loop.Scan() {
|
for loop.Scan() {
|
||||||
repo := loop.Repo()
|
repo := loop.Repo()
|
||||||
repo.Status.CheckoutBranch(targetName)
|
repo.Status.CheckoutBranch(targetName)
|
||||||
repo.Scan()
|
repo.Scan()
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
})
|
})
|
||||||
me.newBranch = grid.NewCombobox()
|
me.newBranch = grid.NewCombobox()
|
||||||
me.newBranch.AddText("master")
|
me.newBranch.AddText("master")
|
||||||
|
|
Loading…
Reference in New Issue