summaryrefslogtreecommitdiff
path: root/git.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-07 19:09:25 -0600
committerJeff Carr <[email protected]>2025-01-07 19:09:25 -0600
commit4efbead37c944b89a63b0c8d89325541d0392c3f (patch)
tree39ad3aa3693c4343dcda326e0dd7fce44166c161 /git.go
parent4dcd9a116440268b3400b7877c0dd291d3154346 (diff)
last of the easy rm old code
Diffstat (limited to 'git.go')
-rw-r--r--git.go104
1 files changed, 2 insertions, 102 deletions
diff --git a/git.go b/git.go
index 8a8b79a..6ab4bbe 100644
--- a/git.go
+++ b/git.go
@@ -3,13 +3,13 @@ package repostatus
import (
"errors"
"strings"
- "time"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
+/*
func (rs *RepoStatus) GetCurrentBranchName() string {
return rs.currentBranch.String()
}
@@ -18,12 +18,6 @@ func (rs *RepoStatus) GetCurrentBranchVersion() string {
return rs.currentVersion.String()
}
-/*
-func (rs *RepoStatus) LastGitPull() (time.Time, error) {
- return rs.mtime(".git/FETCH_HEAD")
-}
-*/
-
func (rs *RepoStatus) Age() time.Duration {
var t *Tag
t = rs.NewestTag()
@@ -41,37 +35,13 @@ func (rs *RepoStatus) Age() time.Duration {
var ErrorMissingGitConfig error = errors.New("missing .git/config")
var ErrorGitPullOnLocal error = errors.New("git pull on local only branch")
+*/
// remove this everything
func (rs *RepoStatus) Path() string {
return rs.realPath.String()
}
-/*
-func (rs *RepoStatus) checkoutBranch(level string, branch string) {
- if rs.CheckDirty() {
- log.Log(REPO, "checkoutBranch() checkDirty() == true for repo", rs.realPath.String(), "looking for branch:", branch)
- return
- }
- out := run(rs.realPath.String(), "git", "checkout "+branch)
- log.Log(REPO, rs.realPath.String(), "git checkout "+branch, "returned", out)
-
- realname := rs.GetCurrentBranchName()
- realversion := rs.GetCurrentBranchVersion()
- log.Log(REPO, rs.realPath.String(), "realname =", realname, "realversion =", realversion)
-
- switch level {
- case "master":
- rs.mainBranchVersion.SetValue(realversion)
- case "devel":
- rs.develBranchVersion.SetValue(realversion)
- case "user":
- rs.userBranchVersion.SetValue(realversion)
- default:
- }
-}
-*/
-
func (rs *RepoStatus) GitState() string {
return rs.gitState.String()
}
@@ -212,52 +182,11 @@ func (rs *RepoStatus) populateTags() {
// rs.tagsDrop.SetText(rs.lasttagrev)
}
-/*
-func (rs *RepoStatus) getBranches() []string {
- var all []string
- var heads []string
- var remotes []string
- heads = gitpb.ListFiles(rs.realPath.String() + "/.git/refs/heads")
- remotes = gitpb.ListFiles(rs.realPath.String() + "/.git/refs/remotes")
-
- all = heads
-
- all = append(all, remotes...)
-
- for _, branch := range all {
- log.Log(REPO, "getBranches()", branch)
- }
- return all
-}
-*/
-
// returns quickly based on the last time it was checked
func (rs *RepoStatus) IsDirty() bool {
return rs.pb.IsDirty()
}
-/*
-// return the list of dirty files (but ignores go.mod & go.sum)
-func (rs *RepoStatus) DirtyList() []string {
- var all []string
- for _, line := range strings.Split(rs.dirtyList, "\n") {
- line = strings.TrimSpace(line)
- parts := strings.Split(line, " ")
- if len(parts) != 2 {
- continue
- }
- if parts[1] == "go.mod" {
- continue
- }
- if parts[1] == "go.sum" {
- continue
- }
- all = append(all, parts[1])
- }
- return all
-}
-*/
-
func (rs *RepoStatus) CheckDirty() bool {
if rs.pb.IsDirty() {
rs.dirtyLabel.SetValue("dirty")
@@ -266,32 +195,3 @@ func (rs *RepoStatus) CheckDirty() bool {
rs.dirtyLabel.SetValue("")
return false
}
-
-/*
-func (rs *RepoStatus) CheckoutBranch(bname string) bool {
- if rs.CheckDirty() {
- log.Log(REPO, rs.realPath.String(), "is dirty")
- log.Info(bname, "is dirty", rs.Path())
- return false
- }
- if !rs.TagExists(bname) {
- // tag does not exist
- log.Log(REPO, "repo does not have branch", bname, rs.Path())
- return false
- }
- cName := rs.GetCurrentBranchName()
- if cName == bname {
- // already on branch
- return true
- }
- cmd := []string{"git", "checkout", bname}
- r := rs.Run(cmd)
- if r.Error != nil {
- log.Log(REPO, "git checkout error:", r.Error)
- return false
- }
- rs.checkCurrentBranchName()
- rs.checkCurrentBranchVersion()
- return true
-}
-*/