summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addRepo.go32
-rw-r--r--common.go6
-rw-r--r--scan.go47
-rw-r--r--structs.go10
-rw-r--r--viewAutotypist.go3
5 files changed, 39 insertions, 59 deletions
diff --git a/addRepo.go b/addRepo.go
index 2535e3f..b863323 100644
--- a/addRepo.go
+++ b/addRepo.go
@@ -18,7 +18,7 @@ func (r *Repo) Hide() {
r.develVersion.Hide()
r.userVersion.Hide()
- r.dirtyLabel.Hide()
+ r.gitState.Hide()
r.endBox.Hide()
// r.statusButton.Hide()
// r.diffButton.Hide()
@@ -41,7 +41,7 @@ func (r *Repo) Show() {
r.develVersion.Show()
r.userVersion.Show()
- r.dirtyLabel.Show()
+ r.gitState.Show()
r.endBox.Show()
// r.statusButton.Show()
// r.diffButton.Show()
@@ -84,11 +84,18 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str
case "autotypist":
newRepo.lastTag = newRepo.Status.MirrorLastTag()
grid.Append(newRepo.lastTag)
- newRepo.masterVersion = grid.NewLabel("").SetProgName("masterVersion")
- newRepo.develVersion = grid.NewLabel("").SetProgName("develVersion")
- newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion")
- newRepo.targetV = r.blind.NewLabel("")
- newRepo.dirtyLabel = grid.NewLabel("")
+
+ newRepo.masterVersion = newRepo.Status.MirrorMasterVersion()
+ grid.Append(newRepo.masterVersion)
+
+ newRepo.develVersion = newRepo.Status.MirrorDevelVersion()
+ grid.Append(newRepo.develVersion)
+
+ newRepo.userVersion = newRepo.Status.MirrorUserVersion()
+ grid.Append(newRepo.userVersion)
+
+ newRepo.gitState = newRepo.Status.MirrorGitState()
+ grid.Append(newRepo.gitState)
newRepo.currentName = newRepo.Status.MirrorCurrentName()
grid.Append(newRepo.currentName)
@@ -162,9 +169,12 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str
newRepo.currentVersion = newRepo.Status.MirrorCurrentVersion()
grid.Append(newRepo.currentVersion)
- newRepo.masterVersion = r.blind.NewLabel("").SetProgName("masterVersion")
- newRepo.dirtyLabel = grid.NewLabel("")
- newRepo.goState = grid.NewLabel("not in the blind")
+ newRepo.gitState = newRepo.Status.MirrorGitState()
+ grid.Append(newRepo.gitState)
+
+ newRepo.goState = newRepo.Status.MirrorGoState()
+ grid.Append(newRepo.goState)
+
newRepo.endBox = grid.NewHorizontalBox("HBOX")
newRepo.endBox.NewButton("Configure", func() {
if newRepo.Status == nil {
@@ -191,8 +201,6 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str
newRepo.Status.Build()
})
}
- newRepo.develVersion = r.blind.NewLabel("").SetProgName("develVersion")
- newRepo.userVersion = r.blind.NewLabel("").SetProgName("userVersion")
default:
}
grid.NextRow()
diff --git a/common.go b/common.go
index 6c5c1c2..371a47f 100644
--- a/common.go
+++ b/common.go
@@ -41,7 +41,7 @@ func AllRepos() []*Repo {
// a human readable state of the current repo
func (r *Repo) State() string {
- return r.dirtyLabel.String()
+ return r.gitState.String()
}
func (r *Repo) Scan() bool {
@@ -113,10 +113,10 @@ func (r *Repo) SetGoState(s string) {
}
func (r *Repo) IsPerfect() bool {
- if r.dirtyLabel.String() == "PERFECT" {
+ if r.gitState.String() == "PERFECT" {
return true
}
- if r.dirtyLabel.String() == "unchanged" {
+ if r.gitState.String() == "unchanged" {
return true
}
return false
diff --git a/scan.go b/scan.go
index a715dda..98ce4c9 100644
--- a/scan.go
+++ b/scan.go
@@ -2,7 +2,6 @@ package repolist
import (
"fmt"
- "os/user"
"strings"
"go.wit.com/log"
@@ -21,7 +20,7 @@ func (r *RepoList) ScanRepositories() (int, string) {
}
})
s := fmt.Sprint(t)
- log.Info("Scanned", i, "repositories. todo: count/show changes", s)
+ log.Info("Scanned", i, "repositories. todo: count/show changes in", s)
return i, s
}
@@ -31,52 +30,24 @@ func (r *Repo) NewScan() bool {
return false
}
- // first run the repostatus update
+ // run the repostatus update
r.Status.UpdateNew()
- // now read those values and display them in our table
- mname := r.Status.GetMasterBranchName()
- mver := r.Status.GetMasterVersion()
- mver = mver + " (" + mname + ")"
- r.masterVersion.SetLabel(mver)
-
- dname := r.Status.GetDevelBranchName()
- dver := r.Status.GetDevelVersion()
- if dname != "devel" {
- dver = dver + " (" + dname + ")"
- }
- r.develVersion.SetLabel(dver)
-
- uname := r.Status.GetUserBranchName()
- uver := r.Status.GetUserVersion()
- usr, _ := user.Current()
- if uname != usr.Username {
- uver = uver + " (" + uname + ")"
- }
- r.userVersion.SetLabel(uver)
-
- // cbname := r.Status.GetCurrentBranchName()
- // cbversion := r.Status.GetCurrentBranchVersion()
- // lasttag := r.Status.GetLastTagVersion()
- // r.lastTag.SetLabel(lasttag)
- // r.currentName.SetLabel(cbname)
- // r.currentVersion.SetLabel(cbversion)
-
+ // print out whatever changes have happened
if c, ok := r.Status.Changed(); ok {
c := strings.TrimSpace(c)
for _, line := range strings.Split(c, "\n") {
log.Info(r.Status.Path(), line)
}
}
- // r.targetV.SetText(r.Status.GetTargetVersion())
- status := r.Status.GetStatus()
- r.dirtyLabel.SetLabel(status)
- if status == "PERFECT" {
- if me.autoHidePerfect {
+ // hide or show repos based on the checkboxes
+ if me.autoHidePerfect {
+ if r.IsPerfect() {
r.Hide()
+ } else {
+ r.Show()
}
- return true
}
- return false
+ return true
}
diff --git a/structs.go b/structs.go
index cba4b69..d9db235 100644
--- a/structs.go
+++ b/structs.go
@@ -41,12 +41,12 @@ type Repo struct {
pLabel *gui.Node // path label
- targetV *gui.Node // the target version
- lastTag *gui.Node // last tagged version label
- currentName *gui.Node // current branch name
+ targetV *gui.Node // the target version
+ lastTag *gui.Node // last tagged version label
+ currentName *gui.Node // current branch name
currentVersion *gui.Node // current branch version
- dirtyLabel *gui.Node // git state (dirty or not?)
- goState *gui.Node // what is the state of the go.sum file
+ gitState *gui.Node // git state (dirty or not?)
+ goState *gui.Node // what is the state of the go.sum file
masterVersion *gui.Node // the master branch version
develVersion *gui.Node // the devel branch version
diff --git a/viewAutotypist.go b/viewAutotypist.go
index b549701..d9a8f03 100644
--- a/viewAutotypist.go
+++ b/viewAutotypist.go
@@ -24,7 +24,8 @@ func AutotypistView(parent *gui.Node) *RepoList {
me.reposgrid.NewLabel("devel version")
me.reposgrid.NewLabel("user version")
me.reposgrid.NewLabel("Status")
- me.reposgrid.NewLabel("Current Version").SetProgName("Current Version")
+ me.reposgrid.NewLabel("Current").SetProgName("CurrentName")
+ me.reposgrid.NewLabel("Version").SetProgName("CurrentVersion")
me.reposgrid.NextRow()
me.blind = gui.RawBox()
return me