time checkout master

This commit is contained in:
Jeff Carr 2025-01-20 01:39:59 -06:00
parent eed26134fd
commit ca51b9ba74
2 changed files with 9 additions and 6 deletions

View File

@ -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()

View File

@ -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