diff options
Diffstat (limited to 'git.go')
| -rw-r--r-- | git.go | 57 |
1 files changed, 30 insertions, 27 deletions
@@ -31,21 +31,21 @@ func (rs *RepoStatus) GetLastTagVersion() string { func (rs *RepoStatus) getCurrentBranchName() string { out := run(rs.repopath, "git", "branch --show-current") - log.Warn("getCurrentBranchName() =", out) + log.Log(INFO, "getCurrentBranchName() =", out) rs.currentBranch.SetValue(out) return out } func (rs *RepoStatus) getCurrentBranchVersion() string { out := run(rs.repopath, "git", "describe --tags") - log.Warn("getCurrentBranchVersion()", out) + log.Log(INFO, "getCurrentBranchVersion()", out) rs.currentVersion.SetValue(out) return out } func (rs *RepoStatus) getLastTagVersion() string { out := run(rs.repopath, "git", "rev-list --tags --max-count=1") - log.Warn("getLastTagVersion()", out) + log.Log(INFO, "getLastTagVersion()", out) rs.lasttagrev = out lastreal := "describe --tags " + out @@ -59,10 +59,10 @@ func (rs *RepoStatus) getLastTagVersion() string { func (rs *RepoStatus) populateTags() { tmp := fullpath(rs.repopath + "/.git/refs/tags") - log.Warn("populateTags() path =", tmp) + log.Log(INFO, "populateTags() path =", tmp) for _, tag := range listFiles(tmp) { if rs.tags[tag] == "" { - log.Warn("populateTags() Adding new tag", tag) + log.Log(INFO, "populateTags() Adding new tag", tag) rs.tagsDrop.AddText(tag) rs.tags[tag] = "origin" } @@ -94,7 +94,7 @@ func (rs *RepoStatus) getBranches() []string { all = append(all, remotes...) for _, branch := range all { - log.Warn("getBranches()", branch) + log.Log(INFO, "getBranches()", branch) } return all } @@ -113,12 +113,12 @@ func (rs *RepoStatus) CheckDirty() bool { return true } if b { - log.Warn("CheckDirty() b =", b, "path =", path, "out =", out) - log.Warn("CheckDirty() no", rs.repopath) + log.Log(INFO, "CheckDirty() b =", b, "path =", path, "out =", out) + log.Log(INFO, "CheckDirty() no", rs.repopath) rs.dirtyLabel.SetValue("no") return false } - log.Warn("CheckDirty() true", rs.repopath) + log.Log(INFO, "CheckDirty() true", rs.repopath) rs.dirtyLabel.SetValue("dirty") return true @@ -129,21 +129,21 @@ func (rs *RepoStatus) CheckoutBranch(branch string) (string, string) { realname := rs.getCurrentBranchName() realversion := rs.getCurrentBranchVersion() - log.Warn(rs.repopath, "realname =", realname, "realversion =", realversion) + log.Log(INFO, rs.repopath, "realname =", realname, "realversion =", realversion) return realname, realversion } func (rs *RepoStatus) checkoutBranch(level string, branch string) { if rs.CheckDirty() { - log.Warn("checkoutBranch() checkDirty() == true for repo", rs.repopath, "looking for branch:", branch) + log.Log(INFO, "checkoutBranch() checkDirty() == true for repo", rs.repopath, "looking for branch:", branch) return } out := run(rs.repopath, "git", "checkout "+branch) - log.Warn(rs.repopath, "git checkout "+branch, "returned", out) + log.Log(INFO, rs.repopath, "git checkout "+branch, "returned", out) realname := rs.getCurrentBranchName() realversion := rs.getCurrentBranchVersion() - log.Warn(rs.repopath, "realname =", realname, "realversion =", realversion) + log.Log(INFO, rs.repopath, "realname =", realname, "realversion =", realversion) switch level { case "master": @@ -156,20 +156,23 @@ func (rs *RepoStatus) checkoutBranch(level string, branch string) { } } -func (rs *RepoStatus) SetMasterBranchName(s string) { - rs.masterDrop.SetText(s) - rs.masterBranchVersion.SetLabel(s) - // rs.major.SetTitle(s) +func (rs *RepoStatus) SetMainWorkingName(s string) { + rs.mainWorkingName.SetValue(s) + rs.masterDrop.SetLabel(s) + rs.masterDrop.SetText("guimaster") } -func (rs *RepoStatus) SetDevelBranchName(s string) { - rs.develDrop.SetText(s) +func (rs *RepoStatus) SetDevelWorkingName(s string) { + rs.develWorkingName.SetValue(s) rs.develBranchVersion.SetLabel(s) + rs.develDrop.SetLabel(s) + rs.develDrop.SetText(s) } -func (rs *RepoStatus) SetUserBranchName(s string) { - rs.userDrop.SetText(s) +func (rs *RepoStatus) SetUserWorkingName(s string) { + rs.userWorkingName.SetValue(s) rs.userBranchVersion.SetLabel(s) + rs.userDrop.SetText(s) } // returns "master", "devel", os.Username, etc @@ -230,7 +233,7 @@ func (rs *RepoStatus) SetUserVersion(s string) { func (rs *RepoStatus) GetStatus() string { rs.changed = false if rs.CheckDirty() { - log.Warn("CheckDirty() true") + log.Log(INFO, "CheckDirty() true") return "dirty" } if rs.userBranchVersion.String() != rs.develBranchVersion.String() { @@ -244,10 +247,10 @@ func (rs *RepoStatus) GetStatus() string { } if rs.CheckBranches() { - log.Info("Branches are Perfect") + log.Log(INFO, "Branches are Perfect") return "PERFECT" } - log.Warn(rs.GetPath(), "Branches are not Perfect") + log.Log(INFO, rs.GetPath(), "Branches are not Perfect") return "unknown branches" } @@ -272,7 +275,7 @@ func (rs *RepoStatus) CheckBranches() bool { // Slice the last 4 runes lastFour := runes[runeCount-4:] if string(lastFour) == "HEAD" { - log.Warn("skip HEAD fullfile", fullfile) + log.Log(INFO, "skip HEAD fullfile", fullfile) continue } @@ -285,9 +288,9 @@ func (rs *RepoStatus) CheckBranches() bool { cmd = append(cmd, "git", "show", "-s", "--format=%ci", hash) _, _, output := RunCmd("/home/jcarr/go/src/"+rs.repopath, cmd) // git show -s --format=%ci <hash> will give you the time - // log.Warn(fullfile) + // log.Log(INFO, fullfile) if hash == hashCheck { - log.Warn(hash, output, b) + log.Log(INFO, hash, output, b) } else { log.Warn("UNKNOWN BRANCHES IN THIS REPO") rs.versionMessage.SetText("UNKNOWN BRANCHES") |
