summaryrefslogtreecommitdiff
path: root/branchesBox.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-16 11:41:29 -0600
committerJeff Carr <[email protected]>2024-02-16 11:41:29 -0600
commitbd62a89a670eab24ff5fd7b1ed155b89dde08157 (patch)
tree1c51c281bcdb04f7f383c0549db0a6bb17e9a8cc /branchesBox.go
parent88ca40bcfa11f464828cace14a07a9b59a00d571 (diff)
continue cleaning up original version
Diffstat (limited to 'branchesBox.go')
-rw-r--r--branchesBox.go37
1 files changed, 26 insertions, 11 deletions
diff --git a/branchesBox.go b/branchesBox.go
index c1de0e2..354fe81 100644
--- a/branchesBox.go
+++ b/branchesBox.go
@@ -1,13 +1,26 @@
package repostatus
import (
- "strings"
+ "path/filepath"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/log"
)
+func (rs *RepoStatus) TagExists(findname string) bool {
+ allTags := rs.Tags.ListAll()
+ for _, t := range allTags {
+ tagname := t.TagString()
+ path, filename := filepath.Split(tagname)
+ if filename == findname {
+ log.Info("found tag:", path, filename, "from", rs.Path())
+ return true
+ }
+ }
+ return false
+}
+
func (rs *RepoStatus) makeBranchesBox(parent *gui.Node) {
rs.gitBranchesGroup = parent.NewGroup("branches") // `progname:"BRANCHES"` // can the toolkits use these for i18n support?
newgrid := rs.gitBranchesGroup.NewGrid("gridnuts", 0, 0)
@@ -45,18 +58,20 @@ func (rs *RepoStatus) makeBranchesBox(parent *gui.Node) {
// rs.targetBranch.AddText("master")
newgrid.NextRow()
- rs.showBranchesButton = newgrid.NewButton("scan branches()", func() {
- err, out := rs.RunCmd([]string{"git", "branch", "--all"})
- if err != nil {
- log.Log(WARN, "git branch failed", rs.String())
+ // runs "git branch --all"
+ rs.gitBranchAll()
+
+ 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")
}
- all := strings.Split(out, "\n")
- for i, s := range all {
- log.Log(WARN, "found branch", i, s)
- rs.targetBranch.AddText(s)
+ if rs.TagExists("devel") {
+ log.Log(WARN, "tag devel exists")
+ } else {
+ log.Log(WARN, "tag devel does not exist")
}
- i := len(all)
- log.Log(WARN, "branch count =", i)
})
newgrid.NextRow()