summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common.go41
-rw-r--r--draw.go1
-rw-r--r--gitConfig.go8
-rw-r--r--merge.go1
-rw-r--r--mirror.go42
-rw-r--r--new.go9
-rw-r--r--structs.go49
7 files changed, 91 insertions, 60 deletions
diff --git a/common.go b/common.go
index cbf798c..8cfed10 100644
--- a/common.go
+++ b/common.go
@@ -3,7 +3,6 @@ package repostatus
import (
"strings"
- "go.wit.com/gui"
"go.wit.com/log"
// "go.wit.com/gui/gui"
)
@@ -178,35 +177,17 @@ func (rs *RepoStatus) SetTargetVersion(s string) {
rs.targetReleaseVersion.SetText(s)
}
-// returns a widget of the last tag that acts as a mirror
-func (rs *RepoStatus) MirrorLastTag() *gui.Node {
- return rs.lasttag.MirrorValue()
-}
-
-func (rs *RepoStatus) MirrorTargetVersion() *gui.Node {
- return rs.targetReleaseVersion.MirrorValue()
-}
-
-func (rs *RepoStatus) MirrorCurrentVersion() *gui.Node {
- return rs.currentVersion.MirrorValue()
-}
-
-func (rs *RepoStatus) MirrorCurrentName() *gui.Node {
- return rs.currentBranch.MirrorValue()
-}
-
-func (rs *RepoStatus) MirrorGitState() *gui.Node {
- return rs.gitState.MirrorValue()
-}
-
-func (rs *RepoStatus) MirrorMasterVersion() *gui.Node {
- return rs.mainBranchVersion.MirrorValue()
-}
-
-func (rs *RepoStatus) MirrorDevelVersion() *gui.Node {
- return rs.develBranchVersion.MirrorValue()
+func (rs *RepoStatus) IsPrivate() bool {
+ if rs.private.String() == "true" {
+ return true
+ }
+ return false
}
-func (rs *RepoStatus) MirrorUserVersion() *gui.Node {
- return rs.userBranchVersion.MirrorValue()
+func (rs *RepoStatus) SetPrivate(b bool) {
+ if b {
+ rs.private.SetText("true")
+ } else {
+ rs.private.SetText("false")
+ }
}
diff --git a/draw.go b/draw.go
index cdf89c2..a008c9c 100644
--- a/draw.go
+++ b/draw.go
@@ -28,6 +28,7 @@ func (rs *RepoStatus) drawGitStatus(box *gui.Node) {
rs.gitState = gadgets.NewOneLiner(newgrid, "git state")
rs.readOnly = gadgets.NewOneLiner(newgrid, "read only")
rs.primitive = gadgets.NewOneLiner(newgrid, "primitive")
+ rs.private = gadgets.NewOneLiner(newgrid, "private")
rs.targetReleaseVersion = gadgets.NewOneLiner(newgrid, "target release version")
rs.speed = gadgets.NewOneLiner(newgrid, "refresh speed =")
diff --git a/gitConfig.go b/gitConfig.go
index 633d732..bc78f9d 100644
--- a/gitConfig.go
+++ b/gitConfig.go
@@ -229,6 +229,14 @@ func (rs *RepoStatus) ReadOnly() bool {
}
}
+func (rs *RepoStatus) SetReadOnly(b bool) {
+ if b {
+ rs.readOnly.SetText("true")
+ } else {
+ rs.readOnly.SetText("false")
+ }
+}
+
func (rs *RepoStatus) processBranch(branch string) {
fullpath := rs.realPath.String()
log.Log(INFO, " ", branch)
diff --git a/merge.go b/merge.go
index 76566ed..0ca2227 100644
--- a/merge.go
+++ b/merge.go
@@ -186,6 +186,7 @@ func (rs *RepoStatus) setTag() bool {
rs.newversion.SetLabel(newver)
return true
}
+
// the newversion field goes through some sanity checking
// to make sure it's greater than the existing tag and
// valid according to golang -- it must be format 'v1.2.3'
diff --git a/mirror.go b/mirror.go
new file mode 100644
index 0000000..e81c71c
--- /dev/null
+++ b/mirror.go
@@ -0,0 +1,42 @@
+package repostatus
+
+import (
+ "go.wit.com/gui"
+ // "go.wit.com/gui/gui"
+)
+
+// this is experiemental work on making 'View's or Table Row's
+// this may or may not be a good idea
+
+// returns a widget of the last tag that acts as a mirror
+func (rs *RepoStatus) MirrorLastTag() *gui.Node {
+ return rs.lasttag.MirrorValue()
+}
+
+func (rs *RepoStatus) MirrorTargetVersion() *gui.Node {
+ return rs.targetReleaseVersion.MirrorValue()
+}
+
+func (rs *RepoStatus) MirrorCurrentVersion() *gui.Node {
+ return rs.currentVersion.MirrorValue()
+}
+
+func (rs *RepoStatus) MirrorCurrentName() *gui.Node {
+ return rs.currentBranch.MirrorValue()
+}
+
+func (rs *RepoStatus) MirrorGitState() *gui.Node {
+ return rs.gitState.MirrorValue()
+}
+
+func (rs *RepoStatus) MirrorMasterVersion() *gui.Node {
+ return rs.mainBranchVersion.MirrorValue()
+}
+
+func (rs *RepoStatus) MirrorDevelVersion() *gui.Node {
+ return rs.develBranchVersion.MirrorValue()
+}
+
+func (rs *RepoStatus) MirrorUserVersion() *gui.Node {
+ return rs.userBranchVersion.MirrorValue()
+}
diff --git a/new.go b/new.go
index c333e24..4e4403c 100644
--- a/new.go
+++ b/new.go
@@ -1,6 +1,7 @@
package repostatus
import (
+ "errors"
"os"
"path/filepath"
"strings"
@@ -47,7 +48,7 @@ func NewRepoStatusWindow(path string) (error, *RepoStatus) {
if windowMap[path] == nil {
log.Log(INFO, "NewRepoStatusWindow() adding new", path)
} else {
- log.Warn("This already exists yet for path", path)
+ log.Warn("This already exists for path", path)
log.Warn("should return windowMap[path] here")
return nil, windowMap[path]
}
@@ -74,6 +75,11 @@ func NewRepoStatusWindow(path string) (error, *RepoStatus) {
realpath = filepath.Join(goSrcDir, path)
isGoLang = true
}
+ if !IsDirectory(realpath) {
+ log.Log(REPOWARN, "directory doesn't exist", realpath)
+ // directory doesn't exist. exit with nil and error nil
+ return errors.New(realpath + " does not exist"), nil
+ }
filename := filepath.Join(realpath, ".git/config")
@@ -120,6 +126,7 @@ func NewRepoStatusWindow(path string) (error, *RepoStatus) {
rs.readOnly.SetValue("true")
// ignore everything else for now
+ // todo: move this logic to cfgfile.go
if strings.HasPrefix(path, "go.wit.com") {
rs.readOnly.SetValue("false")
}
diff --git a/structs.go b/structs.go
index 9576bb9..7ce4c7d 100644
--- a/structs.go
+++ b/structs.go
@@ -6,26 +6,20 @@ import (
)
type RepoStatus struct {
- ready bool
-
- // keeps track of changes that might have happened
- changed bool
+ ready bool
+ changed bool // keeps track of changes that might have happened
changes string
+ dirty bool // updates each time CheckDirty() is run
+ tags map[string]string
- // updates each time CheckDirty() is run
- dirty bool
-
- tags map[string]string
-
- window *gadgets.BasicWindow
-
- // a box of all the git tags
- Tags *GitTagBox
+ window *gadgets.BasicWindow // the main window for this repo
+ Tags *GitTagBox // a box of all the git tags
dirtyLabel *gadgets.OneLiner
readOnly *gadgets.OneLiner
gitState *gadgets.OneLiner
primitive *gadgets.OneLiner
+ private *gadgets.OneLiner
path *gadgets.OneLiner
goSrcPath *gadgets.OneLiner
@@ -36,22 +30,19 @@ type RepoStatus struct {
currentBranch *gadgets.OneLiner
currentVersion *gadgets.OneLiner
- lasttag *gadgets.OneLiner
- mainBranchVersion *gadgets.OneLiner
- develBranchVersion *gadgets.OneLiner
- userBranchVersion *gadgets.OneLiner
-
- mainWorkingName *gadgets.OneLiner
- develWorkingName *gadgets.OneLiner
- userWorkingName *gadgets.OneLiner
-
- develMergeB *gui.Node
- mainMergeB *gui.Node
- releaseVersion *gui.Node
-
- minor *gadgets.BasicCombobox
- major *gadgets.BasicCombobox
- revision *gadgets.BasicCombobox
+ mainWorkingName *gadgets.OneLiner // the actual name of the primary branch
+ develWorkingName *gadgets.OneLiner // the actual name of the devel branch
+ userWorkingName *gadgets.OneLiner // the actual name of the user branch
+ develMergeB *gui.Node // button to merge from user to devel
+ mainMergeB *gui.Node // button to merge from devel to master
+ releaseVersion *gui.Node // the release version
+ minor *gadgets.BasicCombobox // the '3' in version v3.1.4
+ major *gadgets.BasicCombobox // the '1' in version v3.1.4
+ revision *gadgets.BasicCombobox // the '4' in version v3.1.4
+ lasttag *gadgets.OneLiner // the last tag version
+ mainBranchVersion *gadgets.OneLiner // the primary branch version
+ develBranchVersion *gadgets.OneLiner // the devel branch version
+ userBranchVersion *gadgets.OneLiner // the user branch version
versionMessage *gadgets.BasicEntry
versionCmds [][]string