summaryrefslogtreecommitdiff
path: root/new.go
diff options
context:
space:
mode:
Diffstat (limited to 'new.go')
-rw-r--r--new.go41
1 files changed, 19 insertions, 22 deletions
diff --git a/new.go b/new.go
index 9fa15b9..a0e31a3 100644
--- a/new.go
+++ b/new.go
@@ -2,7 +2,6 @@ package repostatus
import (
"os"
- "strings"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/protobuf/gitpb"
@@ -41,10 +40,6 @@ func SetWorkPath(path string) {
// it's doesn't need to be displayed so it'll work fine even in an embedded space
func NewRepoStatusWindow(repo *gitpb.Repo) (*RepoStatus, error) {
path := repo.GoPath
- goSrcDir := os.Getenv("FORGE_GOSRC")
- realpath := repo.FullPath
- isGoLang := true
-
if windowMap[path] == nil {
log.Log(INFO, "NewRepoStatusWindow() adding new", path)
} else {
@@ -56,6 +51,9 @@ func NewRepoStatusWindow(repo *gitpb.Repo) (*RepoStatus, error) {
rs := &RepoStatus{
ready: false,
}
+ rs.pb = repo
+ // realpath := repo.FullPath
+ // isGoLang := true
rs.tags = make(map[string]string)
rs.window = gadgets.RawBasicWindow("GO Repo Details " + path)
@@ -83,34 +81,33 @@ func NewRepoStatusWindow(repo *gitpb.Repo) (*RepoStatus, error) {
// save ~/go/src & the whole path strings
rs.path.SetValue(path)
- rs.goSrcPath.SetValue(goSrcDir)
- rs.realPath.SetValue(realpath)
+ rs.goSrcPath.SetValue(os.Getenv("FORGE_GOSRC"))
+ rs.realPath.SetValue(rs.pb.GetFullPath())
// add all the tags
rs.makeTagBox(box2)
rs.readGitConfig()
- 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")
- }
- if strings.HasPrefix(path, "git.wit.org") {
+ if rs.pb.GetReadOnly() {
+ rs.readOnly.SetValue("true")
+ } else {
rs.readOnly.SetValue("false")
}
+ rs.mainWorkingName.SetText(rs.pb.GetMasterBranchName())
+ rs.mainBranchVersion.SetLabel(rs.pb.GetMasterBranchName())
+
+ rs.develWorkingName.SetText(rs.pb.GetDevelBranchName())
+ rs.develBranchVersion.SetLabel(rs.pb.GetDevelBranchName())
- // tries 'master', 'main', etc.
- rs.guessMainWorkingName()
- // tries 'devel', etc
- rs.guessDevelWorkingName()
- // sets this to os.Username
- rs.setUserWorkingName()
+ rs.userWorkingName.SetText(rs.pb.GetUserBranchName())
+ rs.userBranchVersion.SetLabel(rs.pb.GetUserBranchName())
- if isGoLang {
+ if rs.pb.GoPath == "" {
+ // not golang repo
+ } else {
rs.isGoLang.SetText("true")
- rs.goPath.SetText(path)
+ rs.goPath.SetText(rs.pb.GoPath)
}
windowMap[path] = rs
return rs, nil