more accurate repo Age()
This commit is contained in:
parent
9e81be86da
commit
0f232fe342
1
Makefile
1
Makefile
|
@ -22,6 +22,7 @@ goimports:
|
||||||
clean:
|
clean:
|
||||||
rm -f *.pb.go
|
rm -f *.pb.go
|
||||||
-rm -f go.*
|
-rm -f go.*
|
||||||
|
go-mod-clean --purge
|
||||||
|
|
||||||
forgeConfig.pb.go: forgeConfig.proto
|
forgeConfig.pb.go: forgeConfig.proto
|
||||||
autogenpb --proto forgeConfig.proto
|
autogenpb --proto forgeConfig.proto
|
||||||
|
|
|
@ -41,7 +41,31 @@ func (f *Forge) PrintHumanTable(allr *gitpb.Repos) {
|
||||||
all := allr.SortByFullPath()
|
all := allr.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
f.sendRepoToTable(repo)
|
f.printRepoToTable(repo)
|
||||||
|
count += 1
|
||||||
|
}
|
||||||
|
log.Info("Total git repositories:", count)
|
||||||
|
}
|
||||||
|
|
||||||
|
// also shows which files are dirty
|
||||||
|
func (f *Forge) PrintHumanTableDirty(allr *gitpb.Repos) {
|
||||||
|
log.DaemonMode(true)
|
||||||
|
|
||||||
|
var count int
|
||||||
|
// log.Info(standardStart5("gopath", "cur name", "master", "user", "repo type"))
|
||||||
|
log.Info(standardTable8("repopath", "cur br", "age", "target", "master", "devel", "user", "curver", "repo type"))
|
||||||
|
all := allr.SortByFullPath()
|
||||||
|
for all.Scan() {
|
||||||
|
repo := all.Next()
|
||||||
|
f.printRepoToTable(repo)
|
||||||
|
if len(repo.DirtyList) != 0 {
|
||||||
|
for _, line := range repo.DirtyList {
|
||||||
|
log.Info("\t", line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var mver string = repo.GetMasterVersion()
|
||||||
|
repo.Tags.GetAge(mver)
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
}
|
}
|
||||||
log.Info("Total git repositories:", count)
|
log.Info("Total git repositories:", count)
|
||||||
|
@ -133,7 +157,7 @@ func standardTable8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 string)
|
||||||
return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
|
return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Forge) sendRepoToTable(repo *gitpb.Repo) {
|
func (f *Forge) printRepoToTable(repo *gitpb.Repo) {
|
||||||
var end string
|
var end string
|
||||||
if repo.IsDirty() {
|
if repo.IsDirty() {
|
||||||
end += "(dirty) "
|
end += "(dirty) "
|
||||||
|
@ -148,6 +172,8 @@ func (f *Forge) sendRepoToTable(repo *gitpb.Repo) {
|
||||||
var gopath string = repo.GetGoPath()
|
var gopath string = repo.GetGoPath()
|
||||||
var rtype string = repo.GetRepoType()
|
var rtype string = repo.GetRepoType()
|
||||||
|
|
||||||
|
// ctime := repo.Tags.GetAge(mhort)
|
||||||
|
// age := shell.FormatDuration(time.Since(ctime))
|
||||||
age := shell.FormatDuration(repo.NewestAge())
|
age := shell.FormatDuration(repo.NewestAge())
|
||||||
|
|
||||||
start := standardTable8(gopath, cname, age, thort, mhort, dhort, uhort, chort, rtype)
|
start := standardTable8(gopath, cname, age, thort, mhort, dhort, uhort, chort, rtype)
|
||||||
|
|
Loading…
Reference in New Issue