예제 #1
0
 public void GitData_Commit_Ctor()
 {
     var gitCommit = new GitData_Commit();
     Assert.IsNotNull(gitCommit);
     Assert.IsNotNull(gitCommit.Tree);
     Assert.IsEmpty  (gitCommit.Tree);
 }
        public static List<GitData_Commit> gitData_Commits(this API_NGit nGit, int max_CommitsToShow , bool mapCommitTrees)
        {
            var gitData_Commits  = new List<GitData_Commit>();
            foreach(var commit in nGit.commits().take(max_CommitsToShow))
            {
                var gitData_Commit = new GitData_Commit
                    {
                        Author    = commit.author_Name(),
                        Committer = commit.committer_Name(),
                        Message   = commit.message(),
                        Sha1      = commit.sha1(),
                        When      = commit.when().toFileTimeUtc()
                    };
                if (commit.ParentCount >0)
                    gitData_Commit.Parents = (from parent in commit.Parents select parent.Name).toList();

                if (mapCommitTrees)
                    gitData_Commit.Tree = commit.gitData_Files(nGit);
                gitData_Commits.add(gitData_Commit);
            }
            return gitData_Commits;
        }