tag date format things
This commit is contained in:
parent
2bc2096e84
commit
88ca40bcfa
|
@ -19,7 +19,7 @@ func (rs *RepoStatus) Changed() bool {
|
|||
|
||||
// deprecate this. returns the gopath right now
|
||||
func (rs *RepoStatus) String() string {
|
||||
log.Warn("RepoStatus.String() is to be deprecated")
|
||||
// log.Warn("RepoStatus.String() is to be deprecated")
|
||||
return rs.path.String()
|
||||
}
|
||||
|
||||
|
@ -101,10 +101,10 @@ func (rs *RepoStatus) RepoType() string {
|
|||
err, output := rs.RunCmd([]string{"go", "list", "-f", "'{{if eq .Name \"main\"}}binary{{else}}library{{end}}'"})
|
||||
if err == nil {
|
||||
output = strings.Trim(output, "'")
|
||||
log.Info("go package is:", output)
|
||||
// log.Info("go package is:", output)
|
||||
return output
|
||||
}
|
||||
log.Info("package is: unknown", err)
|
||||
// log.Info("package is: unknown", err)
|
||||
return ""
|
||||
}
|
||||
|
||||
|
|
8
git.go
8
git.go
|
@ -207,14 +207,14 @@ func (rs *RepoStatus) SetMainWorkingName(s string) {
|
|||
}
|
||||
_, ok := rs.gitConfig.branches[s]
|
||||
if ok {
|
||||
log.Info("git branch", s, "seems to exist")
|
||||
// log.Info("git branch", s, "seems to exist")
|
||||
rs.mainWorkingName.SetValue(s)
|
||||
return
|
||||
}
|
||||
s = "guimaster"
|
||||
_, ok = rs.gitConfig.branches[s]
|
||||
if ok {
|
||||
log.Info("git branch", s, "seems to exist")
|
||||
// log.Info("git branch", s, "seems to exist")
|
||||
rs.mainWorkingName.SetValue(s)
|
||||
return
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ func (rs *RepoStatus) SetMainWorkingName(s string) {
|
|||
s = "master"
|
||||
_, ok = rs.gitConfig.branches[s]
|
||||
if ok {
|
||||
log.Info("git branch", s, "seems to exist")
|
||||
// log.Info("git branch", s, "seems to exist")
|
||||
rs.mainWorkingName.SetValue(s)
|
||||
return
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ func (rs *RepoStatus) SetMainWorkingName(s string) {
|
|||
s = "main"
|
||||
_, ok = rs.gitConfig.branches[s]
|
||||
if ok {
|
||||
log.Info("git branch", s, "seems to exist")
|
||||
// log.Info("git branch", s, "seems to exist")
|
||||
rs.mainWorkingName.SetValue(s)
|
||||
return
|
||||
}
|
||||
|
|
19
tagWindow.go
19
tagWindow.go
|
@ -90,10 +90,10 @@ func (rs *RepoStatus) makeTagBox(box *gui.Node) {
|
|||
// git rev-parse HEAD
|
||||
// if last tag == HEAD, then remove it
|
||||
|
||||
tags := []string{"%(tag)", "%(*objectname)", "%(taggerdate:raw)", "%(subject)", "%(*authorname)", "%(*authoremail)"}
|
||||
tags := []string{"%(objectname)", "%(creatordate)", "%(*authordate)", "%(refname)", "%(subject)"}
|
||||
format := strings.Join(tags, "_,,,_")
|
||||
cmd := []string{"git", "for-each-ref", "--sort=taggerdate", "--format", format}
|
||||
log.Info("RUNNING:", strings.Join(cmd, " "))
|
||||
// log.Info("RUNNING:", strings.Join(cmd, " "))
|
||||
err, output := rs.RunCmd(cmd)
|
||||
if err != nil {
|
||||
output = "git error_,,,_a_,,,_b_,,,c"
|
||||
|
@ -106,21 +106,22 @@ func (rs *RepoStatus) makeTagBox(box *gui.Node) {
|
|||
|
||||
for i, line := range lines {
|
||||
var parts []string
|
||||
parts = make([]string, 6)
|
||||
parts = make([]string, 0)
|
||||
parts = strings.Split(line, "_,,,_")
|
||||
log.Info("found tag:", i, parts)
|
||||
if parts[0] == "" {
|
||||
if len(parts) != 5 {
|
||||
log.Info("tag error:", i, parts)
|
||||
continue
|
||||
}
|
||||
// log.Info("found tag:", i, parts)
|
||||
rTag := new(repoTag)
|
||||
rTag.tag = grid.NewLabel(parts[0])
|
||||
rTag.ref = grid.NewEntrybox(parts[1])
|
||||
rTag.tag = grid.NewLabel(parts[3])
|
||||
rTag.ref = grid.NewEntrybox(parts[0])
|
||||
|
||||
_, stamp, dur := getDateStamp(parts[2]) //
|
||||
_, stamp, dur := getGitDateStamp(parts[1])
|
||||
rTag.date = grid.NewLabel(stamp)
|
||||
grid.NewLabel(dur)
|
||||
|
||||
rTag.subject = grid.NewLabel(parts[3])
|
||||
rTag.subject = grid.NewLabel(parts[4])
|
||||
rTag.deleteB = grid.NewButton("delete", func() {
|
||||
tagversion := parts[0]
|
||||
log.Info("remove tag", tagversion)
|
||||
|
|
14
unix.go
14
unix.go
|
@ -274,7 +274,19 @@ func readFileToString(filename string) (string, error) {
|
|||
return strings.TrimSpace(string(data)), nil
|
||||
}
|
||||
|
||||
func getDateStamp(raw string) (time.Time, string, string) {
|
||||
// converts a git for-each-ref date. "Wed Feb 7 10:13:38 2024 -0600"
|
||||
func getGitDateStamp(gitdefault string) (time.Time, string, string) {
|
||||
// now := time.Now().Format("Wed Feb 7 10:13:38 2024 -0600")
|
||||
const gitLayout = "Mon Jan 2 15:04:05 2006 -0700"
|
||||
tagTime, err := time.Parse(gitLayout, gitdefault)
|
||||
if err != nil {
|
||||
log.Warn("GOT THIS IN PARSE AAA."+gitdefault+".AAA")
|
||||
log.Warn(err)
|
||||
return time.Now(), "Feb 1 12:34:56 1978 -0600", ""
|
||||
}
|
||||
return tagTime, gitdefault, getDurationStamp(tagTime)
|
||||
}
|
||||
func getRawDateStamp(raw string) (time.Time, string, string) {
|
||||
parts := strings.Split(raw, " ")
|
||||
if len(parts) == 0 {
|
||||
// raw was blank here
|
||||
|
|
Loading…
Reference in New Issue