diff --git a/doClean.go b/doClean.go index fc04bdc..f072906 100644 --- a/doClean.go +++ b/doClean.go @@ -6,22 +6,29 @@ package main import ( "fmt" "path/filepath" + "time" + "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/forgepb" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) func checkRemoteBranches(repo *gitpb.Repo) error { + if err := repo.ReloadCheck(); err != nil { + log.Info("need to reload", repo.FullPath) + } if repo.VerifyRemoteAndLocalBranches(repo.GetDevelBranchName()) { + } else { repo.Reload() me.forge.SetConfigSave(true) - return log.Errorf("devel is bad") + return log.Errorf("remote devel is out of sync with local") } if repo.VerifyRemoteAndLocalBranches(repo.GetMasterBranchName()) { + } else { repo.Reload() me.forge.SetConfigSave(true) - return log.Errorf("master is bad") + return log.Errorf("remote master is out of sync with local") } return nil } @@ -33,7 +40,17 @@ func doClean() error { if argv.Clean.Verify != nil { stats := me.forge.RillRepos(checkRemoteBranches) - _ = stats + for path, stat := range stats { + if stat.Err == nil { + continue + } + dur := stat.End.Sub(stat.Start) + if dur > time.Second { + log.Infof("%s checkRemoteBranches() took a long time (%s) (err=%v)\n", path, shell.FormatDuration(dur), stat.Err) + } + } + // log.Infof("%-60s, %-60s %v %s\n", stat.Start, stat.End.String(), dur, path) + // log.Infof("%-30v %s %v\n", dur, path, stat.Err) return nil } diff --git a/main.go b/main.go index c7db9d7..7606bd5 100644 --- a/main.go +++ b/main.go @@ -43,6 +43,15 @@ func getVersion(repo *gitpb.Repo, name string) string { return strings.TrimSpace(output) } +func reloadCheck(repo *gitpb.Repo) error { + if err := repo.ReloadCheck(); err != nil { + log.Info("need to reload", repo.FullPath) + configSave = true + return err + } + return nil +} + func main() { me = new(mainType) prep.Bash(ARGNAME, argv.DoAutoComplete) // this line should be: prep.Bash(argv) @@ -50,6 +59,7 @@ func main() { me.pp = arg.MustParse(&argv) me.forge = forgepb.Init() + me.forge.RillRepos(reloadCheck) me.forge.ScanGoSrc() // initialize patches