Exemplo n.º 1
0
        /// <summary>
        /// Retrives the tree changes for the given commit.
        /// </summary>
        /// <returns></returns>
        public static LibGit2Sharp.TreeChanges GetTreeChangesForCommit(LibGit2Sharp.Repository repo, Commit commit)
        {
            // Retrieve the Tree for this commit.
            LibGit2Sharp.Tree thisTree = ((LibGit2Sharp.Commit) repo.Lookup(commit.ObjectId)).Tree;

            // Retrieve the Tree for the previous commit (parent).
            // TODO: What about Merge commits?
            LibGit2Sharp.Tree parentTree = ((LibGit2Sharp.Commit) repo.Lookup(commit.Parents.ElementAt(0).ObjectId)).Tree;

            // Take the diff.
            return repo.Diff.Compare(parentTree, thisTree);
        }
Exemplo n.º 2
0
		public static TreeChanges GetChangedFiles (LibGit2Sharp.Repository repo, string refRev)
		{
			return GitUtil.CompareCommits (repo, repo.Lookup<Commit> (refRev), repo.Head.Tip);
		}