2024-02-14 00:09:58 -06:00
|
|
|
package repostatus
|
|
|
|
|
|
|
|
import (
|
2024-02-15 22:50:50 -06:00
|
|
|
"go.wit.com/gui"
|
2024-02-14 00:09:58 -06:00
|
|
|
"go.wit.com/lib/gadgets"
|
|
|
|
"go.wit.com/log"
|
|
|
|
)
|
|
|
|
|
2024-02-15 22:50:50 -06:00
|
|
|
func (rs *RepoStatus) makeBranchesBox(parent *gui.Node) {
|
|
|
|
rs.gitBranchesGroup = parent.NewGroup("branches") // `progname:"BRANCHES"` // can the toolkits use these for i18n support?
|
2024-02-14 00:19:36 -06:00
|
|
|
newgrid := rs.gitBranchesGroup.NewGrid("gridnuts", 0, 0)
|
2024-02-14 00:09:58 -06:00
|
|
|
|
2024-02-15 22:50:50 -06:00
|
|
|
rs.lasttag = gadgets.NewOneLiner(newgrid, "last tag") // `progname:"LASTTAG"`
|
2024-02-14 00:19:36 -06:00
|
|
|
newgrid.NextRow()
|
2024-02-14 00:09:58 -06:00
|
|
|
|
2024-02-16 20:36:31 -06:00
|
|
|
rs.mainBranchVersion = gadgets.NewOneLiner(newgrid, "master") // `progname:"MASTERBRANCH"`
|
2024-02-14 00:19:36 -06:00
|
|
|
newgrid.NextRow()
|
2024-02-15 22:50:50 -06:00
|
|
|
rs.develBranchVersion = gadgets.NewOneLiner(newgrid, "devel") // `progname:"DEVELBRANCH"`
|
2024-02-14 00:19:36 -06:00
|
|
|
newgrid.NextRow()
|
2024-02-15 22:50:50 -06:00
|
|
|
rs.userBranchVersion = gadgets.NewOneLiner(newgrid, "user") // `progname:"USERBRANCH"`
|
2024-02-14 00:19:36 -06:00
|
|
|
newgrid.NextRow()
|
2024-02-14 00:09:58 -06:00
|
|
|
|
2024-02-15 22:50:50 -06:00
|
|
|
rs.currentBranch = gadgets.NewOneLiner(newgrid, "current branch") // `progname:"CURRENTBRANCH"`
|
2024-02-14 00:19:36 -06:00
|
|
|
newgrid.NextRow()
|
2024-02-15 22:50:50 -06:00
|
|
|
rs.currentVersion = gadgets.NewOneLiner(newgrid, "current version") // `progname:"CURRENTVERSION"`
|
2024-02-14 00:19:36 -06:00
|
|
|
newgrid.NextRow()
|
2024-02-14 00:09:58 -06:00
|
|
|
|
2024-02-15 22:50:50 -06:00
|
|
|
rs.switchBranchB = newgrid.NewButton("Switch Branch", func() { // `progname:"SWITCH"`
|
2024-02-14 01:01:00 -06:00
|
|
|
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")
|
|
|
|
}
|
2024-02-20 14:45:43 -06:00
|
|
|
rs.updateNew()
|
2024-02-14 01:01:00 -06:00
|
|
|
})
|
|
|
|
|
2024-02-15 22:50:50 -06:00
|
|
|
rs.targetBranch = newgrid.NewDropdown() // `progname:"TARGET"`
|
2024-02-14 01:01:00 -06:00
|
|
|
// rs.targetBranch.AddText("master")
|
|
|
|
newgrid.NextRow()
|
|
|
|
|
2024-02-16 11:41:29 -06:00
|
|
|
// runs "git branch --all"
|
2024-02-22 17:19:29 -06:00
|
|
|
// rs.gitBranchAll()
|
2024-02-16 11:41:29 -06:00
|
|
|
|
|
|
|
rs.showBranchesButton = newgrid.NewButton("find jcarr and devel", func() {
|
|
|
|
if rs.TagExists("jcarr") {
|
|
|
|
log.Log(WARN, "tag jcarr exists")
|
|
|
|
} else {
|
|
|
|
log.Log(WARN, "tag jcarr does not exist")
|
2024-02-15 22:50:50 -06:00
|
|
|
}
|
2024-02-16 11:41:29 -06:00
|
|
|
if rs.TagExists("devel") {
|
|
|
|
log.Log(WARN, "tag devel exists")
|
|
|
|
} else {
|
|
|
|
log.Log(WARN, "tag devel does not exist")
|
2024-02-14 01:01:00 -06:00
|
|
|
}
|
2024-02-14 00:09:58 -06:00
|
|
|
})
|
2024-02-14 00:19:36 -06:00
|
|
|
newgrid.NextRow()
|
2024-02-14 00:09:58 -06:00
|
|
|
|
|
|
|
rs.checkBranchesButton = newgrid.NewButton("CheckBranches()", func() {
|
|
|
|
if rs.CheckBranches() {
|
|
|
|
log.Log(WARN, "Branches are perfect")
|
|
|
|
} else {
|
|
|
|
log.Log(WARN, "Branches are not perfect")
|
|
|
|
}
|
|
|
|
})
|
2024-02-14 01:01:00 -06:00
|
|
|
newgrid.NextRow()
|
|
|
|
|
|
|
|
newgrid.NewButton("Revert master to devel", func() {
|
|
|
|
rs.RevertMasterToDevel()
|
|
|
|
})
|
2024-02-14 00:09:58 -06:00
|
|
|
}
|