private string GetCanonicalName(CommitChange change) { var path = change.Path; var oldPath = change.OldPath; if (change.Status == FileHistoryType.Added) { _fileCanonicalMapper[path] = path; } else if (change.OldExists.HasValue && change.OldExists.Value && oldPath != path) { _fileCanonicalMapper[path] = _fileCanonicalMapper[oldPath]; } return(_fileCanonicalMapper[path]); }
public void AddHistory(Commit commit, CommitChange change, Contribution contribution) { if (change.Status != FileHistoryType.Renamed && change.Status != FileHistoryType.Added && change.Status != FileHistoryType.Deleted) { return; } FileHistories.Add(new FileHistory() { File = this, Contribution = contribution, FileHistoryType = change.Status, SubscriptionId = contribution.SubscriptionId, OldPath = change.Status == FileHistoryType.Renamed ? change.OldPath : null, Path = change.Path, }); }
private void AddContribution(Commit commit, string canonicalName, CommitChange change, Contributor contributor) { var file = GetFile(canonicalName); var contribution = new Contribution() { ActivityId = commit.Sha, ContributionType = ContributionType.Commit, ContributorEmail = commit.AuthorEmail, ContributorName = commit.AuthorName, ContributorGithubLogin = commit.AuthorGitHubLogin ?? contributor.GitHubLogin, File = file, SubscriptionId = _subscription.Id, Contributor = contributor, DateTime = commit.DateTime }; file.AddHistory(commit, change, contribution); contributor.AssignContribution(contribution); }