예제 #1
0
        private LinkedList <HashTableIntervalGroup <File> > GetFilesPerInterval(IntervalGroupedCommitCollection commitsGroupedByInterval)
        {
            var intervalGroups = new LinkedList <HashTableIntervalGroup <File> >();

            foreach (LinkedIntervalGroup <Commit> commitGroup in commitsGroupedByInterval)
            {
                var filesPerInterval = new HashTableIntervalGroup <File>();
                intervalGroups.AddLast(filesPerInterval);
                filesPerInterval.StartTime = commitGroup.StartTime;
                filesPerInterval.EndTime   = commitGroup.EndTime;

                foreach (Commit commit in commitGroup.Elements)
                {
                    foreach (CommitFile file in commit.Files)
                    {
                        if (!IncludeFile(file.FilePath))
                        {
                            continue;
                        }

                        if (!filesPerInterval.Elements.ContainsKey(file.FilePath))
                        {
                            filesPerInterval.Elements.Add(file.FilePath, new File {
                                FilePath = file.FilePath
                            });
                        }

                        filesPerInterval.Elements[file.FilePath].LinesAdded   += file.LinesAdded;
                        filesPerInterval.Elements[file.FilePath].LinesDeleted += file.LinesDeleted;
                    }
                }
            }

            return(intervalGroups);
        }
예제 #2
0
        private void InternalExecute(DateTime startTime, TimeSpan interval, IEnumerable <Commit> history)
        {
            var commitsGroupedByInterval = new IntervalGroupedCommitCollection(startTime, interval, history);

            LinkedList <HashTableIntervalGroup <File> > intervalGroups = GetFilesPerInterval(commitsGroupedByInterval);

            CalculateLinesOfCodePerFile(intervalGroups);

            _aggregateStorage.Save(intervalGroups);
        }