diff options
Diffstat (limited to 'rill.go')
| -rw-r--r-- | rill.go | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -160,6 +160,48 @@ func (f *Forge) RillRepos(rillf func(*gitpb.Repo) error) map[string]*RillStats { return stats } +// returns the set of failed repos +func (f *Forge) RunOnReposNew(repos *gitpb.Repos, rillf func(*gitpb.Repo) error) *gitpb.Repos { + stats := f.RunOnRepos(repos, rillf) + failed := gitpb.NewRepos() + counter := 1 + for s, stat := range stats { + if stat.Err == nil { + continue + } + counter += 1 + found := f.Repos.FindByFullPath(s) + if found == nil { + log.Info("found", found, "'"+s+"'") + panic("wrong namespace logic. couldn't find repo from stats") + } + newr := failed.Clone(found) + newr.State = fmt.Sprintf("%v (%d)", stat.Err, counter) + } + + return failed +} + +// dumb & slow, but needed. This is old school dumb. Before we had the awesome machines we have today. +// Use this if you think SMP processing might be the problem. +// if this works, and GO Rill doesn't work, then you, yes you, are the problem. Your code sucks. +// fix it, happy hacking +func (f *Forge) RunOnReposNewDumb(repos *gitpb.Repos, rillf func(*gitpb.Repo) error) *gitpb.Repos { + failed := gitpb.NewRepos() + counter := 1 + for repo := range repos.IterAll() { + err := rillf(repo) + if err == nil { + continue + } + newr := failed.Clone(repo) + newr.State = fmt.Sprintf("%v (%d)", err, counter) + counter += 1 + } + + return failed +} + // x is the size of the queued up pool (shouldn't matter here for this I think) // y is how many simultanous functions will run // todo: tune and compute x,y by # of CPUs and disk io |
