working on branches
This commit is contained in:
parent
9acbb24284
commit
fc9c26cc8d
72
doExamine.go
72
doExamine.go
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"slices"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.wit.com/lib/gui/shell"
|
"go.wit.com/lib/gui/shell"
|
||||||
|
@ -15,14 +16,79 @@ func doExamine() bool {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
if tag := repo.ExamineBranches(); tag != nil {
|
if tag := repo.ExamineBranches(); tag != nil {
|
||||||
me.found.AppendByGoPath(repo)
|
me.found.AppendByGoPath(repo)
|
||||||
ctime := tag.Creatordate.AsTime()
|
// ctime := tag.Creatordate.AsTime()
|
||||||
dur := time.Since(ctime)
|
// dur := time.Since(ctime)
|
||||||
log.Printf("UNKNOWN BRANCH %-50s %s %4s %s\n", repo.GetFullPath(), tag.Hash, shell.FormatDuration(dur), tag.Refname)
|
// log.Printf("UNKNOWN BRANCH %-50s %s %4s %s\n", repo.GetFullPath(), tag.Hash, shell.FormatDuration(dur), tag.Refname)
|
||||||
|
repo.CurrentTag = tag
|
||||||
|
} else {
|
||||||
|
repo.CurrentTag = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(me.found.Repos) == 0 {
|
if len(me.found.Repos) == 0 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
// slices.Reverse(me.found.Repos)
|
||||||
|
slices.SortFunc(me.found.Repos, func(a, b *gitpb.Repo) int {
|
||||||
|
atime := a.CurrentTag.Creatordate.AsTime()
|
||||||
|
btime := b.CurrentTag.Creatordate.AsTime()
|
||||||
|
if atime.Before(btime) {
|
||||||
|
// log.Info("atime vs btime is 0", atime, btime)
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
// log.Info("atime vs btime is 1", atime, btime)
|
||||||
|
return -1
|
||||||
|
})
|
||||||
|
all = me.found.All()
|
||||||
|
me.found = new(gitpb.Repos)
|
||||||
|
for all.Scan() {
|
||||||
|
repo := all.Next()
|
||||||
|
if isNormal(repo) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
tag := repo.CurrentTag
|
||||||
|
ctime := tag.Creatordate.AsTime()
|
||||||
|
dur := time.Since(ctime)
|
||||||
|
log.Printf("UNKNOWN BRANCH %-50s %s %4s %s\n", repo.GetFullPath(), tag.Hash, shell.FormatDuration(dur), tag.Refname)
|
||||||
|
showNotDevel(repo)
|
||||||
|
|
||||||
|
me.found.AppendByGoPath(repo)
|
||||||
|
}
|
||||||
me.forge.PrintHumanTableDirty(me.found)
|
me.forge.PrintHumanTableDirty(me.found)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isNormal(repo *gitpb.Repo) bool {
|
||||||
|
if repo.IsDirty() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if repo.GetUserVersion() != repo.GetDevelVersion() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func showNotDevel(repo *gitpb.Repo) error {
|
||||||
|
var cmd []string
|
||||||
|
cmd = append(cmd, "git")
|
||||||
|
cmd = append(cmd, "log")
|
||||||
|
cmd = append(cmd, "--format=\"%H\"")
|
||||||
|
cmd = append(cmd, repo.CurrentTag.Hash)
|
||||||
|
cmd = append(cmd, "--not")
|
||||||
|
cmd = append(cmd, "devel")
|
||||||
|
r, err := repo.RunStrictNew(cmd)
|
||||||
|
if err != nil {
|
||||||
|
log.Info("Error", cmd, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if r == nil {
|
||||||
|
log.Info("Error r == nil", cmd, err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if len(r.Stdout) != 0 {
|
||||||
|
for i, line := range r.Stdout {
|
||||||
|
log.Info(i, line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue