summaryrefslogtreecommitdiff
path: root/doCheckout.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-20 07:58:13 -0600
committerJeff Carr <[email protected]>2025-01-20 07:58:13 -0600
commiteeb3306bd505cf291333e10ccd50ffd788d45537 (patch)
treea9b2dfdfae88d24b1d063bf04a146ab48510a131 /doCheckout.go
parent4721184398013ac30160bc5bbde5244256f15d88 (diff)
better loggingv0.22.59
Diffstat (limited to 'doCheckout.go')
-rw-r--r--doCheckout.go36
1 files changed, 24 insertions, 12 deletions
diff --git a/doCheckout.go b/doCheckout.go
index 7f9a6fa..40522e7 100644
--- a/doCheckout.go
+++ b/doCheckout.go
@@ -36,9 +36,10 @@ func IsEverythingOnMaster() (int, int, int, error) {
return total, count, nope, nil
}
-func IsEverythingOnDevel() (int, int, error) {
+func IsEverythingOnDevel() (int, int, int, error) {
var total int
var count int
+ var nope int
// first make sure every repo is on the master branch
all := me.forge.Repos.All()
@@ -47,18 +48,20 @@ func IsEverythingOnDevel() (int, int, error) {
total += 1
if repo.GetDevelBranchName() == repo.GetCurrentBranchName() {
count += 1
+ } else {
+ nope += 1
}
}
- log.Printf("Devel branch check. %d total repos. %d repos on the devel branch\n", total, count)
if total != count {
- return total, count, ErrorNotAllReposOnDevel
+ return total, count, nope, ErrorNotAllReposOnDevel
}
- return total, count, nil
+ return total, count, nope, nil
}
-func IsEverythingOnUser() (int, int, error) {
+func IsEverythingOnUser() (int, int, int, error) {
var total int
var count int
+ var nope int
// first make sure every repo is on the master branch
all := me.forge.Repos.All()
@@ -67,13 +70,14 @@ func IsEverythingOnUser() (int, int, error) {
total += 1
if repo.GetCurrentBranchName() == repo.GetUserBranchName() {
count += 1
+ } else {
+ nope += 1
}
}
- log.Printf("User branch check. %d total repos. %d repos on the user branch\n", total, count)
if total != count {
- return total, count, ErrorNotAllReposOnUser
+ return total, count, nope, ErrorNotAllReposOnUser
}
- return total, count, nil
+ return total, count, nope, nil
}
func doGitReset() {
@@ -108,13 +112,18 @@ func rillCheckoutUser(repo *gitpb.Repo) error {
return nil
}
+// trys to figure out if there is still something to update
func doAllCheckoutUser() error {
+ now := time.Now()
me.forge.RillFuncError(rillCheckoutUser)
count := me.forge.RillReload()
if count != 0 {
me.forge.ConfigSave()
}
- if _, _, err := IsEverythingOnUser(); err != nil {
+
+ total, count, nope, err := IsEverythingOnUser()
+ log.Printf("User branch check. %d total repos. (%d ok) (%d not on user branch) (%s)\n", total, count, nope, shell.FormatDuration(time.Since(now)))
+ if err != nil {
// display all repos not on user
me.found = new(gitpb.Repos)
all := me.forge.Repos.SortByFullPath()
@@ -144,13 +153,18 @@ func rillCheckoutDevel(repo *gitpb.Repo) error {
return nil
}
+// is every repo on the devel branch?
func doAllCheckoutDevel() error {
+ now := time.Now()
me.forge.RillFuncError(rillCheckoutDevel)
count := me.forge.RillReload()
if count != 0 {
me.forge.ConfigSave()
}
- if _, _, err := IsEverythingOnDevel(); err != nil {
+
+ total, count, nope, err := IsEverythingOnDevel()
+ log.Printf("Devel branch check. %d total repos. (%d ok) (%d not on user branch) (%s)\n", total, count, nope, shell.FormatDuration(time.Since(now)))
+ if err != nil {
// display all repos not on user
me.found = new(gitpb.Repos)
all := me.forge.Repos.SortByFullPath()
@@ -198,8 +212,6 @@ func rillCheckoutMaster(repo *gitpb.Repo) error {
}
// trys to figure out if there is still something to update
-// todo: redo this logic as it is terrible
-
func doAllCheckoutMaster() error {
now := time.Now()
me.forge.RillFuncError(rillCheckoutMaster)