From 0e05b773cf01e917809d1e7848dc1944eedd0921 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 4 Sep 2025 21:34:50 -0500 Subject: [PATCH] make a test checkout devel function --- branches.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/branches.go b/branches.go index d4849d5..2f72127 100644 --- a/branches.go +++ b/branches.go @@ -204,6 +204,51 @@ func (f *Forge) makeUserBranches() error { return nil } +func testReload(repo *gitpb.Repo) error { + if !repo.DidRepoChange() { + return nil + } + repo.Reload() + return log.Errorf("repo changed") +} + +func (f *Forge) DoAllCheckoutDevelNew(force bool) error { + f.makeDevelBranches() + + // first run git checkout + stats := f.RillFuncError(rillCheckoutDevel) + for path, stat := range stats { + dur := stat.End.Sub(stat.Start) + if dur > 1*time.Second { + log.Infof("%s git checkout took a long time (%s)\n", path, shell.FormatDuration(dur)) + } + if stat.Err == nil { + // there was no error + continue + } + // didn't change to devel + } + + var counter int + // recreate the repo protobuf + stats = f.RillFuncError(testReload) + for path, stat := range stats { + dur := stat.End.Sub(stat.Start) + if dur > 1*time.Second { + log.Infof("%s # Reload took a long time (%s)\n", path, shell.FormatDuration(dur)) + } + if stat.Err == nil { + // repo didn't reload + continue + } + // repo reloaded + counter += 1 + } + log.Info("reloaded", counter, "repos") + f.configSave = true + return nil +} + // is every repo on the devel branch? func (f *Forge) DoAllCheckoutDevel(force bool) error { now := time.Now()