diff options
Diffstat (limited to 'draw.go')
| -rw-r--r-- | draw.go | 42 |
1 files changed, 17 insertions, 25 deletions
@@ -1,7 +1,6 @@ package repostatus import ( - "io/ioutil" "strconv" "strings" @@ -62,23 +61,15 @@ func (rs *RepoStatus) drawGitBranches() { newgrid.NewButton("show branches", func() { all := rs.getBranches() i := len(all) - count.Set(strconv.Itoa(i)) + count.Set(strconv.Itoa(i) + " branches") }) count = newgrid.NewLabel("") + newgrid.NewButton("check branches", func() { - all := rs.getBranches() - path := fullpath(rs.repopath + "/.git/refs/") - for _, b := range all { - parts := strings.Split(b, "/") - rdir := "heads" - if len(parts) == 2 { - rdir = "remotes" - } - fullfile := path + "/" + rdir + "/" + b - content, _ := ioutil.ReadFile(fullfile) - hash := strings.TrimSpace(string(content)) - // log.Warn(fullfile) - log.Warn(hash, b) + if rs.checkBranches() { + log.Warn("Branches are perfect") + } else { + log.Warn("Branches are not perfect") } }) } @@ -121,12 +112,13 @@ func (rs *RepoStatus) drawGitCommands() { log.Warn("something went wrong switching to the master branch. full stop!") return } - if rs.runGitCommands() { - log.Warn("THINGS SEEM OK") - } else { + if ! rs.runGitCommands() { log.Warn("SOMETHING WENT WRONG") + return } rs.develMerge.Disable() // don't let this run twice for now + rs.Update() + log.Warn("THINGS SEEM OK") }) rs.major = gadgets.NewBasicCombobox(newgrid, "major") @@ -159,11 +151,11 @@ func (rs *RepoStatus) drawGitCommands() { return } log.Warn("COMMIT IT HERE") - if rs.runGitCommands() { - log.Warn("THINGS SEEM OK") - } else { + if ! rs.runGitCommands() { log.Warn("SOMETHING WENT WRONG") } + rs.Update() + log.Warn("THINGS SEEM OK") }) newgrid.Margin() @@ -183,12 +175,10 @@ func (rs *RepoStatus) setTag() bool { log.Warn("current release a,b,c =", major, minor, revision) newa, _ := strconv.Atoi(rs.major.Get()) - newb, _ := strconv.Atoi(rs.minor.Get()) - newc, _ := strconv.Atoi(rs.revision.Get()) newver := strconv.Itoa(newa) if newa < olda { - log.Warn("new version bad", newver, "vs old version", lasttag) + log.Warn("new version bad", newver, "vs old version", lasttag, "newa =", newa, "olda =", olda) rs.newversion.Set("bad") return false } @@ -200,9 +190,10 @@ func (rs *RepoStatus) setTag() bool { return true } + newb, _ := strconv.Atoi(rs.minor.Get()) newver = strconv.Itoa(newa) + "." + strconv.Itoa(newb) if newb < oldb { - log.Warn("new version bad", newver, "vs old version", lasttag) + log.Warn("new version bad", newver, "vs old version", lasttag, "newb =", newb, "oldb =", oldb) rs.newversion.Set("bad") return false } @@ -214,6 +205,7 @@ func (rs *RepoStatus) setTag() bool { return true } + newc, _ := strconv.Atoi(rs.revision.Get()) newver = strconv.Itoa(newa) + "." + strconv.Itoa(newb) + "." + strconv.Itoa(newc) if newc <= oldc { log.Warn("new version bad", newver, "vs old version", lasttag) |
