make a test checkout devel function

This commit is contained in:
Jeff Carr 2025-09-04 21:34:50 -05:00
parent 625dfe2f68
commit 0e05b773cf
1 changed files with 45 additions and 0 deletions

View File

@ -204,6 +204,51 @@ func (f *Forge) makeUserBranches() error {
return nil 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? // is every repo on the devel branch?
func (f *Forge) DoAllCheckoutDevel(force bool) error { func (f *Forge) DoAllCheckoutDevel(force bool) error {
now := time.Now() now := time.Now()