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