diff --git a/branchesBox.go b/branchesBox.go index 9aa78b9..d24af80 100644 --- a/branchesBox.go +++ b/branchesBox.go @@ -24,8 +24,30 @@ func (rs *RepoStatus) makeBranchesBox() { rs.currentVersion = gadgets.NewOneLiner(newgrid, "current version") newgrid.NextRow() - rs.showBranchesButton = newgrid.NewButton("getBranches()", func() { + rs.switchBranchB = newgrid.NewButton("Switch Branch", func() { + bname := rs.targetBranch.String() + log.Info("Should switch to branch", bname, "here") + + var all [][]string + all = append(all, []string{"git", "checkout", bname}) + if rs.DoAll(all) { + log.Info("branch switched to", bname) + } else { + log.Info("branch switched to", bname, "failed") + } + rs.UpdateCurrent() + }) + + rs.targetBranch = newgrid.NewDropdown() + // rs.targetBranch.AddText("master") + newgrid.NextRow() + + rs.showBranchesButton = newgrid.NewButton("scan branches()", func() { all := rs.getBranches() + for i, s := range all { + log.Log(WARN, "found branch", i, s) + rs.targetBranch.AddText(s) + } i := len(all) log.Log(WARN, "branch count =", i) }) @@ -38,4 +60,9 @@ func (rs *RepoStatus) makeBranchesBox() { log.Log(WARN, "Branches are not perfect") } }) + newgrid.NextRow() + + newgrid.NewButton("Revert master to devel", func() { + rs.RevertMasterToDevel() + }) } diff --git a/structs.go b/structs.go index f1e3309..22195bb 100644 --- a/structs.go +++ b/structs.go @@ -72,4 +72,7 @@ type RepoStatus struct { gitConfig *GitConfig goConfig GoConfig + + switchBranchB *gui.Node + targetBranch *gui.Node }