Пример #1
0
        public IRepositorySnapshot EnrichWithGitStats(IRepositorySnapshot repositorySnapshot,
                                                      GitStatGranularity granularity,
                                                      Option <ISubject <int> > progress)
        {
            _logger.Debug($"Enriching repository snapshot with hash {repositorySnapshot.AtHash} with git stats");

            return(repositorySnapshot.With(repositorySnapshot
                                           .Files
                                           .Apply(files => files.AsParallel()
                                                  .Select((f, i) =>
            {
                var result = EnrichWithGitStats(f, granularity);
                progress.Do(subject => subject.OnNext(i + 1));

                return result;
            }))
                                           .ToList(),
                                           _gitCommands.GetHashForLatestCommit(repositorySnapshot.RootPath),
                                           commitCreationDate:
                                           _gitCommands.DateOfLatestCommitOnBranch(repositorySnapshot.RootPath),
                                           numberOfCommitsOnBranch:
                                           _gitCommands.NumberOfCommitsOnCurrentBranch(repositorySnapshot.RootPath)));

            // I can't find a way to make this work consistently, rev-parse doesn't return the precise number of branch-specific commits
            // commitRelativePosition: _gitCommands.GetOrderOfCurrentHeadRelativeToFirstCommitOfBranch(repositorySnapshot.RootPath),
        }