Compare commits

..

No commits in common. "guimaster" and "v0.22.71" have entirely different histories.

2 changed files with 90 additions and 0 deletions

58
git.go
View File

@ -40,3 +40,61 @@ func (rs *RepoStatus) checkCurrentBranchName() string {
rs.NoteChange("current branch has changed from " + currentname + " to " + out) rs.NoteChange("current branch has changed from " + currentname + " to " + out)
return out return out
} }
/*
func (rs *RepoStatus) oldgitDescribeByHash(hash string) (string, error) {
if hash == "" {
return "", errors.New("hash was blank")
}
r := shell.PathRunLog(rs.realPath.String(), []string{"git", "describe", "--tags", "--always", hash}, INFO)
out := strings.Join(r.Stdout, "\n")
if r.Error != nil {
log.Warn("not in a git repo or bad hash?", r.Error, rs.Path())
return out, r.Error
}
return out, r.Error
}
func (rs *RepoStatus) oldgitDescribeByName(name string) (string, error) {
name = strings.TrimSpace(name)
if name == "" {
// git will return the current tag
r := shell.PathRunLog(rs.Path(), []string{"git", "describe", "--tags", "--always"}, INFO)
output := strings.Join(r.Stdout, "\n")
if r.Error != nil {
log.Warn("gitDescribeByName() not in a git repo?", r.Error, rs.Path())
}
return strings.TrimSpace(output), r.Error
}
if !rs.LocalTagExists(name) {
// tag does not exist
return "", errors.New("gitDescribeByName() git fatal: Not a valid object name")
}
cmd := []string{"git", "describe", "--tags", "--always", name}
r := shell.PathRunLog(rs.Path(), cmd, INFO)
output := strings.Join(r.Stdout, "\n")
if r.Error != nil {
log.Warn("cmd =", cmd)
log.Warn("err =", r.Error)
log.Warn("not in a git repo or bad tag?", rs.Path())
}
return strings.TrimSpace(output), r.Error
}
*/
/*
func (rs *RepoStatus) populateTags() {
tmp := rs.realPath.String() + "/.git/refs/tags"
log.Log(REPO, "populateTags() path =", tmp)
for _, tag := range gitpb.ListFiles(tmp) {
if rs.tags[tag] == "" {
log.Log(REPO, "populateTags() Adding new tag", tag)
// rs.tagsDrop.AddText(tag)
rs.tags[tag] = "origin"
}
}
// rs.tagsDrop.SetText(rs.lasttagrev)
}
*/

View File

@ -57,6 +57,38 @@ func NewRepoStatusWindow(repo *gitpb.Repo) (*RepoStatus, error) {
// show standard git commit and merge controls // show standard git commit and merge controls
rs.drawGitCommands(primarybox) rs.drawGitCommands(primarybox)
/*
// save ~/go/src & the whole path strings
rs.path.SetValue(path)
rs.goSrcPath.SetValue(os.Getenv("FORGE_GOSRC"))
rs.realPath.SetValue(rs.pb.GetFullPath())
// add all the tags
// rs.makeTagBox(box2)
// rs.readGitConfig()
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())
rs.userWorkingName.SetText(rs.pb.GetUserBranchName())
rs.userBranchVersion.SetLabel(rs.pb.GetUserBranchName())
if rs.pb.GetGoPath() == "" {
// not golang repo
} else {
rs.isGoLang.SetText("true")
rs.goPath.SetText(rs.pb.GetGoPath())
}
*/
windowMap[path] = rs windowMap[path] = rs
return rs, nil return rs, nil
} }