当前位置: 首页>>代码示例>>C#>>正文


C# Commit.CompareAgainst方法代码示例

本文整理汇总了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();
		}
开发者ID:baseric,项目名称:GitSharp.Demo,代码行数:16,代码来源:CommitDiffView.xaml.cs

示例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);
     }
 }
开发者ID:stschake,项目名称:GitSharp,代码行数:36,代码来源:CommitTests.cs


注:本文中的Commit.CompareAgainst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。