diff options
| author | Jeff Carr <[email protected]> | 2024-02-16 17:55:13 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-16 17:55:13 -0600 |
| commit | 0b4f4d76866ccc500112cfe553240c47961258e2 (patch) | |
| tree | 5b68ef32ea6dab46b0aa3c7c522f4852b62bfcd3 /update.go | |
| parent | bd62a89a670eab24ff5fd7b1ed155b89dde08157 (diff) | |
ready to work on creating branches
Diffstat (limited to 'update.go')
| -rw-r--r-- | update.go | 89 |
1 files changed, 26 insertions, 63 deletions
@@ -29,55 +29,45 @@ func (rs *RepoStatus) UpdateNew() { log.Error(errors.New("Update() is not ready yet")) return } - // do things that are safe even if the git tree is dirty - // rs.path.SetValue(rs.repopath) - rs.getCurrentBranchName() - // rs.window.SetTitle(rs.repopath + " GO repo Details") - rs.getCurrentBranchVersion() - rs.getLastTagVersion() + + // store the current checked out branch name and version + rs.checkCurrentBranchName() + rs.checkCurrentBranchVersion() + + // read in the tags rs.populateTags() + + // record if the repo is dirty rs.CheckDirty() - // get the master branch version + // store the last tag version + rs.setLastTagVersion() + + // store the master branch version mName := rs.GetMasterBranchName() - cmd := []string{"git", "describe", "--tags", mName} - err, out := rs.RunCmd(cmd) - if err == nil { - log.Log(INFO, "git cmd =", cmd, "worked =", out) - rs.SetMasterVersion(out) - } else { - log.Log(WARN, "git cmd =", cmd) - log.Log(WARN, "git err =", err) - log.Log(WARN, "git master failed", mName, rs.Path()) - } + out, _ := rs.gitDescribeByName(mName) + rs.setMasterVersion(out) - // get the devel branch version + // store the devel branch version dName := rs.GetDevelBranchName() - cmd = []string{"git", "describe", "--tags", dName} - err, out = rs.RunCmd(cmd) - if err == nil { - log.Log(INFO, "git cmd =", cmd, "worked =", out) - rs.SetDevelVersion(out) + if dName == "" { + rs.setDevelVersion("") } else { - log.Log(WARN, "git cmd =", cmd) - log.Log(WARN, "git err =", err) - log.Log(WARN, "git devel failed", dName, rs.Path()) + out, _ = rs.gitDescribeByName(dName) + rs.setDevelVersion(out) } - // get the user branch version + // store the user branch version uName := rs.GetUserBranchName() - cmd = []string{"git", "describe", "--tags", uName} - err, out = rs.RunCmd(cmd) - if err == nil { - log.Log(INFO, "git cmd =", cmd, "worked =", out) - rs.SetUserVersion(out) + if uName == "" { + rs.setUserVersion("") } else { - log.Log(WARN, "git cmd =", cmd) - log.Log(WARN, "git err =", err) - log.Log(WARN, "git user failed", uName, rs.Path()) + out, _ = rs.gitDescribeByName(uName) + rs.setUserVersion(out) } } +/* // deprecate / redo what is left of this func (rs *RepoStatus) UpdateOld() { if !rs.Ready() { @@ -120,6 +110,7 @@ func (rs *RepoStatus) UpdateOld() { rs.setSpeed(duration) log.Log(INFO, "Update() END") } +*/ func (rs *RepoStatus) setSpeed(duration time.Duration) { s := fmt.Sprint(duration) @@ -194,31 +185,3 @@ func (rs *RepoStatus) EnableSelectTag() { rs.releaseVersion.Enable() } } - -// This doesn't switch branches -func (rs *RepoStatus) UpdateCurrent() { - if !rs.Ready() { - log.Log(WARN, "can't update yet. ready is false") - log.Error(errors.New("Update() is not ready yet")) - return - } - log.Log(INFO, "Update() START") - rs.getCurrentBranchName() - rs.getCurrentBranchVersion() - rs.getLastTagVersion() - rs.populateTags() - rs.CheckDirty() - - // read in the .git/config each update - rs.readGitConfig() - - // this looks into .git somewhat - rs.CheckBranches() - - if rs.dirtyLabel.String() != "no" { - // the repo is dirty - log.Warn("dirty label != no. actual value:", rs.dirtyLabel.String()) - rs.DisableEverything() - return - } -} |
