public List <Commit> GetCommits(string path, List <Commit> alreadyDeclaredCommits = null) { List <Commit> commits = new List <Commit>(); using (SvnClient svnClient = new SvnClient()) { System.Collections.ObjectModel.Collection <SvnLogEventArgs> logEventArgs; svnClient.GetLog(new Uri(path), out logEventArgs); logEventArgs.ForEach(commit => { if (alreadyDeclaredCommits != null && alreadyDeclaredCommits.Any( declaredCommit => declaredCommit.Revision == commit.Revision.ToString())) { commits.Add(alreadyDeclaredCommits.Find(c => c.Revision == commit.Revision.ToString())); return; } List <Changes> changes = GetChanges(commit.Revision, path); Commit commitItem = new Commit() { Author = commit.Author, Date = commit.Time.Date, Email = " - ", Message = commit.LogMessage, Revision = commit.Revision.ToString() }; changes.ForEach(change => commitItem.AddChanges(change)); commits.Add(commitItem); }); } return(commits); }
public List <Commit> GetCommits(GitBranch branch, string repositoryPath) { List <Commit> commits = new List <Commit>(); foreach (GitCommit gitCommitInfo in branch.Commits) { Commit commit = GetCommitFromGitCommit(gitCommitInfo, repositoryPath); commits.Add(commit); } return(commits); }
private Commit GetCommitFromGitCommit(GitCommit gitCommit, string repositoryPath) { List <Changes> changes = GetChanges(gitCommit, repositoryPath); Commit newCommit = new Commit() { Revision = gitCommit.Sha, Author = gitCommit.Author.Name, Date = gitCommit.Author.When.DateTime, Email = gitCommit.Author.Email, Message = gitCommit.MessageShort }; changes.ForEach(change => newCommit.AddChanges(change)); return(newCommit); }