use standard table code. start labeling private repos
This commit is contained in:
parent
72e8d3659f
commit
076bdfb9c6
|
@ -18,6 +18,8 @@ package forgepb
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -116,6 +118,17 @@ func (fc *ForgeConfigs) DebName(gopath string) string {
|
||||||
return normalBase
|
return normalBase
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// a work in progress
|
||||||
|
func (f *Forge) IsPrivate(repo *gitpb.Repo) bool {
|
||||||
|
namespace := repo.GetNamespace()
|
||||||
|
if namespace == "" {
|
||||||
|
// assume true
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return f.Config.IsPrivate(namespace)
|
||||||
|
}
|
||||||
|
|
||||||
// is this a non-publishable repo?
|
// is this a non-publishable repo?
|
||||||
// matches package names from apt
|
// matches package names from apt
|
||||||
//
|
//
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
package forgepb
|
package forgepb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"go.wit.com/lib/cobol"
|
"go.wit.com/lib/cobol"
|
||||||
|
@ -44,7 +43,7 @@ func (f *Forge) PrintHumanTable(allr *gitpb.Repos) {
|
||||||
// print the header
|
// print the header
|
||||||
args := []string{"namespace", "cur br", "age", "master", "devel", "user", "", "lasttag", "next", "repo type"}
|
args := []string{"namespace", "cur br", "age", "master", "devel", "user", "", "lasttag", "next", "repo type"}
|
||||||
sizes := []int{40, 9, 6, 16, 16, 16, 1, 12, 12, 8}
|
sizes := []int{40, 9, 6, 16, 16, 16, 1, 12, 12, 8}
|
||||||
log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args)))
|
log.Info(cobol.TerminalChomp(cobol.StandardTableSize10(sizes, args)))
|
||||||
|
|
||||||
all := allr.SortByFullPath()
|
all := allr.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
|
@ -63,7 +62,7 @@ func (f *Forge) PrintForgedTable(allr *gitpb.Repos) {
|
||||||
// print the header
|
// print the header
|
||||||
args := []string{"namespace", "cur br", "age", "master", "devel", "last tag", "", "", "", ""}
|
args := []string{"namespace", "cur br", "age", "master", "devel", "last tag", "", "", "", ""}
|
||||||
sizes := []int{40, 9, 6, 12, 16, 16, 16, 12, 12, 8}
|
sizes := []int{40, 9, 6, 12, 16, 16, 16, 12, 12, 8}
|
||||||
log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args)))
|
log.Info(cobol.TerminalChomp(cobol.StandardTableSize10(sizes, args)))
|
||||||
|
|
||||||
all := allr.SortByFullPath()
|
all := allr.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
|
@ -82,7 +81,7 @@ func (f *Forge) PrintHumanTableFull(allr *gitpb.Repos) {
|
||||||
// print the header
|
// print the header
|
||||||
args := []string{"cur br", "age", "master", "devel", "user", "", "lasttag", "next", "repo type", "namespace"}
|
args := []string{"cur br", "age", "master", "devel", "user", "", "lasttag", "next", "repo type", "namespace"}
|
||||||
sizes := []int{9, 6, 16, 16, 16, 1, 12, 12, 8, 0}
|
sizes := []int{9, 6, 16, 16, 16, 1, 12, 12, 8, 0}
|
||||||
log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args)))
|
log.Info(cobol.TerminalChomp(cobol.StandardTableSize10(sizes, args)))
|
||||||
|
|
||||||
all := allr.SortByFullPath()
|
all := allr.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
|
@ -102,7 +101,7 @@ func (f *Forge) PrintHumanTableDirty(allr *gitpb.Repos) {
|
||||||
// print the header
|
// print the header
|
||||||
args := []string{"namespace", "cur br", "age", "master", "devel", "user", "", "lasttag", "next", "repo type"}
|
args := []string{"namespace", "cur br", "age", "master", "devel", "user", "", "lasttag", "next", "repo type"}
|
||||||
sizes := []int{40, 9, 6, 16, 16, 16, 1, 12, 12, 8}
|
sizes := []int{40, 9, 6, 16, 16, 16, 1, 12, 12, 8}
|
||||||
log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args)))
|
log.Info(cobol.TerminalChomp(cobol.StandardTableSize10(sizes, args)))
|
||||||
|
|
||||||
for repo := range allr.IterAll() {
|
for repo := range allr.IterAll() {
|
||||||
f.printRepoToTable(repo, sizes, false)
|
f.printRepoToTable(repo, sizes, false)
|
||||||
|
@ -147,6 +146,7 @@ func tallyBranchTotals(t *tally, repo *gitpb.Repo) {
|
||||||
t.unknown += 1
|
t.unknown += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func standardTable5(arg1, arg2, arg3, arg4, arg5 string) string {
|
func standardTable5(arg1, arg2, arg3, arg4, arg5 string) string {
|
||||||
len1 := 40
|
len1 := 40
|
||||||
len2 := 12
|
len2 := 12
|
||||||
|
@ -176,7 +176,9 @@ func standardTable5(arg1, arg2, arg3, arg4, arg5 string) string {
|
||||||
s += "%-" + fmt.Sprintf("%d", len5) + "s"
|
s += "%-" + fmt.Sprintf("%d", len5) + "s"
|
||||||
return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5)
|
return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
func standardTableSize10(sizes []int, args []string) string {
|
func standardTableSize10(sizes []int, args []string) string {
|
||||||
var s string
|
var s string
|
||||||
for i, si := range sizes {
|
for i, si := range sizes {
|
||||||
|
@ -204,6 +206,7 @@ func standardTableSize10(sizes []int, args []string) string {
|
||||||
return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)
|
return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)
|
||||||
// return fmt.Sprintf(s, args)
|
// return fmt.Sprintf(s, args)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (f *Forge) printRepoToTable(repo *gitpb.Repo, sizes []int, full bool) {
|
func (f *Forge) printRepoToTable(repo *gitpb.Repo, sizes []int, full bool) {
|
||||||
var end string
|
var end string
|
||||||
|
@ -226,6 +229,17 @@ func (f *Forge) printRepoToTable(repo *gitpb.Repo, sizes []int, full bool) {
|
||||||
gopath = repo.GetFullPath()
|
gopath = repo.GetFullPath()
|
||||||
}
|
}
|
||||||
var rtype string = repo.GetRepoType()
|
var rtype string = repo.GetRepoType()
|
||||||
|
switch rtype {
|
||||||
|
case "binary":
|
||||||
|
rtype = "GO bin"
|
||||||
|
case "library":
|
||||||
|
rtype = "GO lib"
|
||||||
|
case "protobuf":
|
||||||
|
rtype = "GO pb"
|
||||||
|
}
|
||||||
|
if f.IsPrivate(repo) {
|
||||||
|
rtype = "priv"
|
||||||
|
}
|
||||||
|
|
||||||
// ctime := repo.Tags.GetAge(mhort)
|
// ctime := repo.Tags.GetAge(mhort)
|
||||||
// age := shell.FormatDuration(time.Since(ctime))
|
// age := shell.FormatDuration(time.Since(ctime))
|
||||||
|
@ -248,7 +262,7 @@ func (f *Forge) printRepoToTable(repo *gitpb.Repo, sizes []int, full bool) {
|
||||||
} else {
|
} else {
|
||||||
args = []string{gopath, cname, age, mhort, dhort, uhort, chort, lasttag, thort, rtype}
|
args = []string{gopath, cname, age, mhort, dhort, uhort, chort, lasttag, thort, rtype}
|
||||||
}
|
}
|
||||||
start := standardTableSize10(sizes, args)
|
start := cobol.StandardTableSize10(sizes, args)
|
||||||
|
|
||||||
if rtype == "protobuf" {
|
if rtype == "protobuf" {
|
||||||
if repo.GoInfo.GoBinary {
|
if repo.GoInfo.GoBinary {
|
||||||
|
@ -307,7 +321,7 @@ func (f *Forge) printForgedToTable(repo *gitpb.Repo, sizes []int) {
|
||||||
|
|
||||||
var args []string
|
var args []string
|
||||||
args = []string{ns, cname, age, mhort, dhort, lasttag, "", "", "", ""}
|
args = []string{ns, cname, age, mhort, dhort, lasttag, "", "", "", ""}
|
||||||
start := standardTableSize10(sizes, args)
|
start := cobol.StandardTableSize10(sizes, args)
|
||||||
|
|
||||||
end += "todo"
|
end += "todo"
|
||||||
|
|
||||||
|
@ -323,7 +337,7 @@ func (psets *Patchsets) PrintTable() {
|
||||||
// print the header
|
// print the header
|
||||||
args := []string{"commit hash", "new hash", "", "", "name", "Repo Namespace", "", "", "", "", ""}
|
args := []string{"commit hash", "new hash", "", "", "name", "Repo Namespace", "", "", "", "", ""}
|
||||||
sizes := []int{12, 12, 3, 3, 40, 80, 2, 2, 2, 2}
|
sizes := []int{12, 12, 3, 3, 40, 80, 2, 2, 2, 2}
|
||||||
log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args)))
|
log.Info(cobol.TerminalChomp(cobol.StandardTableSize10(sizes, args)))
|
||||||
|
|
||||||
var countCONTENTS int
|
var countCONTENTS int
|
||||||
var countPARTS int
|
var countPARTS int
|
||||||
|
|
Loading…
Reference in New Issue