summaryrefslogtreecommitdiff
path: root/doGui.go
diff options
context:
space:
mode:
Diffstat (limited to 'doGui.go')
-rw-r--r--doGui.go79
1 files changed, 63 insertions, 16 deletions
diff --git a/doGui.go b/doGui.go
index 4b73077..88baa94 100644
--- a/doGui.go
+++ b/doGui.go
@@ -112,30 +112,77 @@ func drawWindow(win *gadgets.BasicWindow) {
log.Info("reposWin == nil")
reposWin.Hide()
}
- targetName := me.newBranch.String()
- log.Warn("setting all branches to", targetName)
- if targetName == "devel" {
- if err := doAllCheckoutDevel(); err != nil {
- log.Info("switching to devel branches failed")
- }
- return
- }
- if targetName == "master" {
- if err := doAllCheckoutMaster(); err != nil {
- log.Info("switching to master branches failed")
- }
- return
+
+ if me.autoCreateBranches.Checked() {
+ argv.Force = true
+ } else {
+ argv.Force = false
}
- // just assume user
- if err := doAllCheckoutUser(); err != nil {
- log.Info("switching to user branches failed")
+ if err := doCheckoutShared(); err != nil {
+ badExit(err)
}
+ /*
+ targetName := me.newBranch.String()
+ log.Warn("setting all branches to", targetName)
+ log.Info("auto create branches =", createBranches)
+ if targetName == "devel" {
+ now := time.Now()
+ if err := doAllCheckoutDevel(); err != nil {
+ }
+ total, count, nope, _ := IsEverythingOnDevel()
+ log.Printf("Devel branch check. %d total repos. (%d ok) (%d not on devel branch) (%s)\n", total, count, nope, shell.FormatDuration(time.Since(now)))
+ if nope != 0 {
+ log.Info("switching to devel branches failed")
+ log.Info("auto create branches =", createBranches)
+ if createBranches {
+ } else {
+ log.Info("You should enable the 'auto create branches' checkbox")
+ }
+ }
+ return
+ }
+ if targetName == "master" {
+ if err := doAllCheckoutMaster(); err != nil {
+ log.Info("switching to master branches failed")
+ }
+ return
+ }
+ now := time.Now()
+ // just assume user
+ if err := doAllCheckoutUser(); err != nil {
+ }
+ total, count, nope, err := IsEverythingOnUser()
+ log.Printf("User branch check. %d total repos. (%d ok) (%d not on user branch) (%s)\n", total, count, nope, shell.FormatDuration(time.Since(now)))
+ if err != nil {
+ log.Info("switching to user branches failed")
+ log.Info("auto create branches =", createBranches)
+ if createBranches {
+ } else {
+ log.Info("You should enable the 'auto create branches' checkbox")
+ }
+ }
+ */
})
me.newBranch = grid.NewDropdown()
me.newBranch.AddText("master")
me.newBranch.AddText("devel")
me.newBranch.AddText(usr.Username)
me.newBranch.SetText(usr.Username)
+ me.argvCheckoutUser = true
+ me.newBranch.Custom = func() {
+ // toggle global values shared by the command line and the gui for doCheckout()
+ me.argvCheckoutUser = false
+ me.argvCheckoutDevel = false
+ me.argvCheckoutMaster = false
+ switch me.newBranch.String() {
+ case "master":
+ me.argvCheckoutMaster = true
+ case "devel":
+ me.argvCheckoutDevel = true
+ default:
+ me.argvCheckoutUser = true
+ }
+ }
// checking this will automatically make the branches off of devel
me.autoCreateBranches = grid.NewCheckbox("auto create branches").SetChecked(true)