From ca51b9ba74535ddfd01b15a395b910ac12767241 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 20 Jan 2025 01:39:59 -0600 Subject: [PATCH] time checkout master --- doCheckout.go | 13 ++++++++----- doClean.go | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/doCheckout.go b/doCheckout.go index 2946500..29a5fe3 100644 --- a/doCheckout.go +++ b/doCheckout.go @@ -2,7 +2,9 @@ package main import ( "fmt" + "time" + "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) @@ -11,7 +13,7 @@ var ErrorNotAllReposOnMaster error = fmt.Errorf("not all repos on are on the mas var ErrorNotAllReposOnDevel error = fmt.Errorf("not all repos on are on the devel branch") var ErrorNotAllReposOnUser error = fmt.Errorf("not all repos on are on the user branch") -func IsEverythingOnMaster() (int, int, error) { +func IsEverythingOnMaster() (int, int, int, error) { var total int var count int var nope int @@ -27,12 +29,11 @@ func IsEverythingOnMaster() (int, int, error) { nope += 1 } } - log.Printf("Master branch check. %d total repos. (%d ok) (%d not on master branch)\n", total, count, nope) if total != count { // log.Info(ErrorNotAllReposOnMaster) - return total, count, ErrorNotAllReposOnMaster + return total, count, nope, ErrorNotAllReposOnMaster } - return total, count, nil + return total, count, nope, nil } func IsEverythingOnDevel() (int, int, error) { @@ -200,13 +201,15 @@ func rillCheckoutMaster(repo *gitpb.Repo) error { // todo: redo this logic as it is terrible func doAllCheckoutMaster() error { + now := time.Now() me.forge.RillFuncError(rillCheckoutMaster) count := me.forge.RillReload() if count != 0 { me.forge.ConfigSave() } - if _, _, err := IsEverythingOnMaster(); err != nil { + if total, count, nope, err := IsEverythingOnMaster(); err != nil { + log.Printf("Master branch check. %d total repos. (%d ok) (%d not on master branch) (%s)\n", total, count, nope, shell.FormatDuration(time.Since(now))) // display all repos not on master me.found = new(gitpb.Repos) all := me.forge.Repos.SortByFullPath() diff --git a/doClean.go b/doClean.go index f7c6489..adeac89 100644 --- a/doClean.go +++ b/doClean.go @@ -32,7 +32,7 @@ func doClean() error { } func doCleanUser() error { - if _, count, err := IsEverythingOnMaster(); err != nil { + if _, count, _, err := IsEverythingOnMaster(); err != nil { if count == 0 { log.Info("No repos are on the master branch") return nil