本文整理汇总了C#中Commit.CompareAgainst方法的典型用法代码示例。如果您正苦于以下问题:C# Commit.CompareAgainst方法的具体用法?C# Commit.CompareAgainst怎么用?C# Commit.CompareAgainst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Commit
的用法示例。
在下文中一共展示了Commit.CompareAgainst方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init(Commit c1, Commit c2)
{
if (c1 == null)
{
m_treediff.ItemsSource = null;
return;
}
//m_title.Content = "Differences between commits " + c1.ShortHash + " and " + c2.ShortHash;
var changes = c1.CompareAgainst(c2);
m_treediff.ItemsSource = changes;
if (changes.Count() > 0)
{
m_treediff.SelectedIndex = 0;
}
FireSelectionChanged();
}
示例2: Commit_changes_to_existing_commit
public void Commit_changes_to_existing_commit()
{
using (var repo = GetTrashRepository())
{
var workingDirectory = repo.WorkingDirectory;
string filepath = Path.Combine(workingDirectory, "README");
File.WriteAllText(filepath, "This is a really short readme file\n\nWill write up some text here.");
repo.Index.Add(filepath);
//repo.Index.Remove(Path.Combine(workingDirectory, "a/a1"));
var commit = repo.Commit("Adding ä README\n\n", new Author("müller", "mü[email protected]"));
Assert.NotNull(commit);
Assert.IsTrue(commit.IsCommit);
Assert.AreEqual(commit.Parent.Hash, "49322bb17d3acc9146f98c97d078513228bbf3c0");
Assert.AreEqual("müller", commit.Author.Name);
Assert.AreEqual("mü[email protected]", commit.Author.EmailAddress);
Assert.AreEqual("Adding ä README\n\n", commit.Message);
// check if tree contains the new file, get the blob and check the content.
Assert.AreEqual(commit, repo.Head.CurrentCommit);
var previous = new Commit(repo, "HEAD^");
Assert.IsTrue(previous.IsCommit);
Assert.AreEqual(previous, commit.Parent);
var changes = previous.CompareAgainst(commit).ToDictionary(change => change.Name);
Assert.AreEqual(ChangeType.Added, changes["README"].ChangeType);
Assert.AreEqual("This is a really short readme file\n\nWill write up some text here.",
(changes["README"].ComparedObject as Blob).Data);
Assert.AreEqual(ChangeType.Deleted, changes["a1"].ChangeType);
Assert.AreEqual(ChangeType.Deleted, changes["a1.txt"].ChangeType);
Assert.AreEqual(ChangeType.Deleted, changes["a2.txt"].ChangeType);
Assert.AreEqual(ChangeType.Deleted, changes["b1.txt"].ChangeType);
Assert.AreEqual(ChangeType.Deleted, changes["b2.txt"].ChangeType);
Assert.AreEqual(ChangeType.Deleted, changes["c1.txt"].ChangeType);
Assert.AreEqual(ChangeType.Deleted, changes["c2.txt"].ChangeType);
Assert.AreEqual(ChangeType.Deleted, changes["master.txt"].ChangeType);
Assert.AreEqual(9, changes.Count);
}
}