74 lines
1.8 KiB
Go
74 lines
1.8 KiB
Go
|
package repostatus
|
||
|
|
||
|
import (
|
||
|
"go.wit.com/lib/gadgets"
|
||
|
"go.wit.com/log"
|
||
|
)
|
||
|
|
||
|
func (rs *RepoStatus) makeBranchesBox() {
|
||
|
rs.gitBranchesGroup = rs.window.Box().NewGroup("branches")
|
||
|
newgrid := rs.gitBranchesGroup.NewGrid("gridnuts", 2, 2)
|
||
|
|
||
|
rs.lasttag = gadgets.NewOneLiner(newgrid, "last tag")
|
||
|
|
||
|
rs.masterBranchVersion = gadgets.NewOneLiner(newgrid, "master")
|
||
|
rs.develBranchVersion = gadgets.NewOneLiner(newgrid, "devel")
|
||
|
rs.userBranchVersion = gadgets.NewOneLiner(newgrid, "user")
|
||
|
|
||
|
rs.currentBranch = gadgets.NewOneLiner(newgrid, "current branch")
|
||
|
rs.currentVersion = gadgets.NewOneLiner(newgrid, "current version")
|
||
|
|
||
|
rs.showBranchesButton = newgrid.NewButton("getBranches()", func() {
|
||
|
all := rs.getBranches()
|
||
|
i := len(all)
|
||
|
log.Log(WARN, "branch count =", i)
|
||
|
})
|
||
|
|
||
|
rs.checkBranchesButton = newgrid.NewButton("CheckBranches()", func() {
|
||
|
if rs.CheckBranches() {
|
||
|
log.Log(WARN, "Branches are perfect")
|
||
|
} else {
|
||
|
log.Log(WARN, "Branches are not perfect")
|
||
|
}
|
||
|
})
|
||
|
|
||
|
newgrid.NewButton("show .git/config", func() {
|
||
|
if rs.gitConfig == nil {
|
||
|
log.Log(WARN, "Nonexistant or damaged .git/config", rs.String())
|
||
|
return
|
||
|
}
|
||
|
log.Log(WARN, ".git/config:", rs.realPath.String())
|
||
|
|
||
|
// The info:
|
||
|
for name, remote := range rs.gitConfig.remotes {
|
||
|
log.Log(WARN, " ", name, "url:", remote.url)
|
||
|
}
|
||
|
for name, branch := range rs.gitConfig.branches {
|
||
|
log.Log(WARN, " ", name, "remote:", branch.remote, "merge", branch.merge)
|
||
|
}
|
||
|
})
|
||
|
|
||
|
newgrid.NewButton("CheckDirty()", func() {
|
||
|
if rs.CheckDirty() {
|
||
|
log.Log(WARN, "is dirty")
|
||
|
} else {
|
||
|
log.Log(WARN, "is not dirty")
|
||
|
}
|
||
|
})
|
||
|
|
||
|
// rs.TagsW = rs.TagWindow()
|
||
|
|
||
|
newgrid.NewButton("Show tags", func() {
|
||
|
if rs.TagsW == nil {
|
||
|
log.Warn("error: found rs.TagsW == nil")
|
||
|
rs.TagsW = rs.TagWindow()
|
||
|
return
|
||
|
}
|
||
|
if rs.TagsW.Hidden() {
|
||
|
rs.TagsW.Show()
|
||
|
} else {
|
||
|
rs.TagsW.Show()
|
||
|
}
|
||
|
})
|
||
|
}
|