summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--argv.go1
-rw-r--r--argvAutocomplete.go2
-rw-r--r--doCommon.go4
-rw-r--r--human.go91
-rw-r--r--humanTable.go (renamed from cobol.go)70
-rw-r--r--main.go18
-rw-r--r--windowPatches.go4
-rw-r--r--windowRepos.go2
8 files changed, 117 insertions, 75 deletions
diff --git a/argv.go b/argv.go
index b80d07e..110de23 100644
--- a/argv.go
+++ b/argv.go
@@ -22,6 +22,7 @@ type args struct {
Rescan *EmptyCmd `arg:"subcommand:rescan" help:"recreate the git protobuf repos.pb file"`
Delete *EmptyCmd `arg:"subcommand:delete" help:"untrack a repo"`
URL string `arg:"--connect" help:"gowebd url"`
+ Show string `arg:"--show" help:"show a repo"`
Bash bool `arg:"--bash" help:"generate bash completion"`
BashAuto []string `arg:"--auto-complete" help:"does the actual autocompletion"`
Force bool `arg:"--force" help:"try to strong arm things"`
diff --git a/argvAutocomplete.go b/argvAutocomplete.go
index c371bb4..1d4b8cf 100644
--- a/argvAutocomplete.go
+++ b/argvAutocomplete.go
@@ -41,7 +41,7 @@ func (args) doBashAuto() {
default:
if argv.BashAuto[0] == ARGNAME {
// list the subcommands here
- fmt.Println("--bash checkout config dirty delete hard-reset list patch pull rescan")
+ fmt.Println("--bash --show checkout config dirty delete hard-reset list patch pull rescan")
}
}
os.Exit(0)
diff --git a/doCommon.go b/doCommon.go
index 110d3ab..1241087 100644
--- a/doCommon.go
+++ b/doCommon.go
@@ -127,7 +127,7 @@ func doAllCheckoutDevel() bool {
me.forge = forgepb.Init()
if !IsEverythingOnDevel() {
log.Info("switching to devel branch failed")
- doCobol()
+ doHumanTable()
badExit(nil)
return false
}
@@ -139,7 +139,7 @@ func doAllCheckoutUser() bool {
me.forge = forgepb.Init()
if !IsEverythingOnUser() {
log.Info("switching to user branch failed")
- doCobol()
+ doHumanTable()
return false
}
return true
diff --git a/human.go b/human.go
new file mode 100644
index 0000000..68d2bfc
--- /dev/null
+++ b/human.go
@@ -0,0 +1,91 @@
+package main
+
+import (
+ "os"
+ "path/filepath"
+ "time"
+
+ "go.wit.com/lib/gui/shell"
+ "go.wit.com/lib/protobuf/gitpb"
+ "go.wit.com/log"
+)
+
+func HumanPrintRepo(check *gitpb.Repo) {
+ if check == nil {
+ log.Info("forge: you sent me nil")
+ return
+ }
+
+ if check.GetTargetVersion() == "" {
+ log.Info("TargetVersion == blank")
+ }
+ if check.GetTargetVersion() == check.GetCurrentVersion() {
+ log.Info("IsReleased() == true. do not release this a second time")
+ } else {
+ log.Info("IsReleased() == false")
+ }
+ if check.CheckDirty() {
+ log.Info("CheckDirty() == true. do not release dirty repos")
+ } else {
+ log.Info("CheckDirty() == false")
+ }
+ if check.GetGoPrimitive() {
+ log.Info("IsPrimitive() == true")
+ } else {
+ log.Info("IsPrimitive() == false")
+ }
+ if me.forge.Config.IsPrivate(check.GetGoPath()) {
+ log.Info("IsPrivate() == true")
+ } else {
+ log.Info("IsPrivate() == false")
+ }
+ if ok, compiled, err := check.IsProtobuf(); ok {
+ log.Info(log.Sprint("IsProtobuf() == true compiled protobuf files = ", compiled))
+ if err != nil {
+ log.Info("IsProtobuf() ERROR = ", err)
+ }
+ for _, s := range compiled {
+ log.Info("\tcompiled file found:", s)
+ }
+ } else {
+ log.Info("IsProtobuf() == false")
+ if err != nil {
+ log.Info("IsProtobuf() ERROR = ", err)
+ }
+ }
+
+ // testNext(check)
+
+ me.found.AppendUniqueGoPath(check)
+ doHumanTable()
+
+ printTime("LastPull", check.Times.LastPull.AsTime())
+ printTime("LastUpdate", check.Times.LastUpdate.AsTime())
+ printTime("LastDirty", check.Times.LastDirty.AsTime())
+ printTime("dir mtime", check.Times.MtimeDir.AsTime())
+ printTime("HEAD mtime", check.Times.MtimeHead.AsTime())
+ printTime("Index mtime", check.Times.MtimeIndex.AsTime())
+ printTime("fetch", check.Times.MtimeFetch.AsTime())
+ printTime("last go.sum", check.Times.LastGoDep.AsTime())
+ printTime("last commit", check.Times.NewestCommit.AsTime())
+}
+
+func testGoRepo(check *gitpb.Repo) {
+ data, _ := os.ReadFile(filepath.Join(check.FullPath, "go.mod"))
+ log.Info(string(data))
+
+ if me.forge.FinalGoDepsCheckOk(check) {
+ log.Info("forge.FinalGoDepsCheck(check) worked!")
+ } else {
+ log.Info("forge.FinalGoDepsCheck(check) failed. boo.")
+ }
+
+}
+
+func printTime(s string, t time.Time) {
+ now := time.Now()
+ dur := now.Sub(t)
+ if dur < (time.Hour * 24) {
+ log.Printf("%s mtime last changed %s\n", s, shell.FormatDuration(dur))
+ }
+}
diff --git a/cobol.go b/humanTable.go
index e75f489..ec5890c 100644
--- a/cobol.go
+++ b/humanTable.go
@@ -32,19 +32,19 @@ import (
// actually, I'd predict some of these will probably end up 240 wide
// long live good eyesight and 4K monitors!
-func doCobol() {
+func doHumanTable() {
log.DaemonMode(true)
// log.Info(standardStart5("gopath", "cur name", "master", "user", "repo type"))
- log.Info(standardStart8("repopath", "cur br", "age", "target", "master", "devel", "user", "curver", "repo type"))
+ log.Info(standardTable8("repopath", "cur br", "age", "target", "master", "devel", "user", "curver", "repo type"))
all := me.found.SortByFullPath()
for all.Scan() {
repo := all.Next()
- verifyPrint(repo)
+ sendRepoToTable(repo)
}
}
-func standardStart5(arg1, arg2, arg3, arg4, arg5 string) string {
+func standardTable5(arg1, arg2, arg3, arg4, arg5 string) string {
len1 := 40
len2 := 12
len3 := 12
@@ -74,7 +74,7 @@ func standardStart5(arg1, arg2, arg3, arg4, arg5 string) string {
return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5)
}
-func standardStart8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 string) string {
+func standardTable8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 string) string {
len1 := 40
len2 := 12
len3 := 6
@@ -130,24 +130,11 @@ func standardStart8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 string)
return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
}
-func verifyPrint(repo *gitpb.Repo) {
+func sendRepoToTable(repo *gitpb.Repo) {
var end string
if repo.IsDirty() {
end += "(dirty) "
}
- // s := make(map[string]string)
- /*
- if !verify(repo, s) {
- log.Info("going to delete", repo.GetGoPath())
- if argv.Fix {
- me.forge.DeleteByGoPath(repo.GetGoPath())
- me.forge.Repos.ConfigSave()
- } else {
- log.Info("need argv --fix to delete", repo.GetGoPath())
- }
- }
- */
-
var mhort string = repo.GetMasterVersion()
var dhort string = repo.GetDevelVersion()
var uhort string = repo.GetUserVersion()
@@ -160,7 +147,7 @@ func verifyPrint(repo *gitpb.Repo) {
age := shell.FormatDuration(repo.NewestAge())
- start := standardStart8(gopath, cname, age, thort, mhort, dhort, uhort, chort, rtype)
+ start := standardTable8(gopath, cname, age, thort, mhort, dhort, uhort, chort, rtype)
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
end += "(readonly) "
@@ -171,46 +158,3 @@ func verifyPrint(repo *gitpb.Repo) {
log.Info(start, end)
}
-
-func verify(repo *gitpb.Repo, s map[string]string) bool {
- s["gopath"] = repo.GetGoPath()
- s["rtype"] = repo.GetRepoType()
-
- s["mname"] = repo.GetMasterBranchName()
- if s["mname"] == "" {
- log.Info("verify() no master branch name", repo.FullPath)
- s["mver"] = repo.GetMasterVersion()
- // return false
- }
- s["mver"] = repo.GetMasterVersion()
-
- s["dname"] = repo.GetDevelBranchName()
- if s["dname"] == "" {
- log.Info("verify() no devel branch name", repo.GetGoPath())
- // return false
- }
- s["uname"] = repo.GetUserBranchName()
- if s["uname"] == "" {
- log.Info("verify() no user branch name", repo.GetGoPath())
- // return false
- }
- s["cname"] = repo.GetCurrentBranchName()
-
- s["mver"] = repo.GetMasterVersion()
- if s["mver"] == "" {
- log.Info("verify() no master branch name", repo.FullPath, repo.GetMasterBranchName())
- }
- s["dver"] = repo.GetDevelVersion()
- if s["dver"] == "" {
- log.Info("verify() no devel branch name", repo.GetGoPath(), repo.GetDevelBranchName())
- }
- s["uver"] = repo.GetUserVersion()
- if s["uver"] == "" {
- log.Info("verify() no user branch name", repo.GetGoPath(), repo.GetUserBranchName())
- }
- s["cver"] = repo.GetCurrentBranchVersion()
- s["tver"] = repo.GetTargetVersion()
- s["url"] = repo.URL
-
- return true
-}
diff --git a/main.go b/main.go
index be2f0b6..faf49e4 100644
--- a/main.go
+++ b/main.go
@@ -70,7 +70,7 @@ func main() {
me.forge = forgepb.Init()
me.found = new(gitpb.Repos)
argv.Checkout.User.findRepos()
- doCobol()
+ doHumanTable()
okExit("")
}
@@ -79,7 +79,7 @@ func main() {
me.forge = forgepb.Init()
me.found = new(gitpb.Repos)
argv.Checkout.Devel.findRepos()
- doCobol()
+ doHumanTable()
okExit("")
}
@@ -88,7 +88,7 @@ func main() {
me.forge = forgepb.Init()
me.found = new(gitpb.Repos)
argv.Checkout.Master.findRepos()
- doCobol()
+ doHumanTable()
}
log.Info("make 'user' the default here?")
okExit("")
@@ -101,7 +101,7 @@ func main() {
doCheckDirtyAndConfigSave()
me.found = new(gitpb.Repos)
findDirty()
- doCobol()
+ doHumanTable()
okExit("")
}
@@ -110,6 +110,12 @@ func main() {
okExit("")
}
+ if argv.Show != "" {
+ repo := me.forge.FindByGoPath(argv.Show)
+ HumanPrintRepo(repo)
+ okExit("")
+ }
+
if argv.GitPull != nil {
argv.GitPull.findRepos()
doGitPull()
@@ -125,7 +131,7 @@ func main() {
if argv.List != nil {
argv.List.findRepos()
// print out the repos
- doCobol()
+ doHumanTable()
okExit("patches")
}
if argv.Patch != nil {
@@ -151,7 +157,7 @@ func main() {
// nothing else was specified to be done,
// then just list the table to stdout
if gui.NoGui() {
- doCobol()
+ doHumanTable()
okExit("")
}
diff --git a/windowPatches.go b/windowPatches.go
index 9cb0d00..0b353ab 100644
--- a/windowPatches.go
+++ b/windowPatches.go
@@ -95,7 +95,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
}
if IsAnythingDirty() {
log.Info("You can't apply patches when repos are dirty")
- doCobol()
+ doHumanTable()
return
}
})
@@ -112,7 +112,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
}
if IsAnythingDirty() {
log.Info("You can't apply patches when repos are dirty")
- doCobol()
+ doHumanTable()
return
}
applyPatchset(pset)
diff --git a/windowRepos.go b/windowRepos.go
index 5f3cf25..a507bc5 100644
--- a/windowRepos.go
+++ b/windowRepos.go
@@ -115,7 +115,7 @@ func (r *repoWindow) repoMenu() *gui.Node {
r.Disable()
if IsAnythingDirty() {
log.Info("You can't apply patches when repos are dirty")
- doCobol()
+ doHumanTable()
return
}
if !r.mergeAllUserToDevel() {