當前位置: 首頁>>代碼示例>>C#>>正文


C# FileTreeIterator.SetDirCacheIterator方法代碼示例

本文整理匯總了C#中NGit.Treewalk.FileTreeIterator.SetDirCacheIterator方法的典型用法代碼示例。如果您正苦於以下問題:C# FileTreeIterator.SetDirCacheIterator方法的具體用法?C# FileTreeIterator.SetDirCacheIterator怎麽用?C# FileTreeIterator.SetDirCacheIterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NGit.Treewalk.FileTreeIterator的用法示例。


在下文中一共展示了FileTreeIterator.SetDirCacheIterator方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: IdOffset

		public virtual void IdOffset()
		{
			Git git = new Git(db);
			WriteTrashFile("fileAinfsonly", "A");
			FilePath fileBinindex = WriteTrashFile("fileBinindex", "B");
			FsTick(fileBinindex);
			git.Add().AddFilepattern("fileBinindex").Call();
			WriteTrashFile("fileCinfsonly", "C");
			TreeWalk tw = new TreeWalk(db);
			DirCacheIterator indexIter = new DirCacheIterator(db.ReadDirCache());
			FileTreeIterator workTreeIter = new FileTreeIterator(db);
			tw.AddTree(indexIter);
			tw.AddTree(workTreeIter);
			workTreeIter.SetDirCacheIterator(tw, 0);
			AssertEntry("d46c305e85b630558ee19cc47e73d2e5c8c64cdc", "a,", tw);
			AssertEntry("58ee403f98538ec02409538b3f80adf610accdec", "a,b", tw);
			AssertEntry("0000000000000000000000000000000000000000", "a", tw);
			AssertEntry("b8d30ff397626f0f1d3538d66067edf865e201d6", "a0b", tw);
			// The reason for adding this test. Check that the id is correct for
			// mixed
			AssertEntry("8c7e5a667f1b771847fe88c01c3de34413a1b220", "fileAinfsonly", tw);
			AssertEntry("7371f47a6f8bd23a8fa1a8b2a9479cdd76380e54", "fileBinindex", tw);
			AssertEntry("96d80cd6c4e7158dbebd0849f4fb7ce513e5828c", "fileCinfsonly", tw);
			NUnit.Framework.Assert.IsFalse(tw.Next());
		}
開發者ID:LunarLanding,項目名稱:ngit,代碼行數:25,代碼來源:FileTreeIteratorTest.cs

示例2: TestDirCacheMatchingId

		public virtual void TestDirCacheMatchingId()
		{
			FilePath f = WriteTrashFile("file", "content");
			Git git = new Git(db);
			WriteTrashFile("file", "content");
			FsTick(f);
			git.Add().AddFilepattern("file").Call();
			DirCacheEntry dce = db.ReadDirCache().GetEntry("file");
			TreeWalk tw = new TreeWalk(db);
			FileTreeIterator fti = new FileTreeIterator(trash, db.FileSystem, ((FileBasedConfig
				)db.GetConfig()).Get(WorkingTreeOptions.KEY));
			tw.AddTree(fti);
			DirCacheIterator dci = new DirCacheIterator(db.ReadDirCache());
			tw.AddTree(dci);
			fti.SetDirCacheIterator(tw, 1);
			while (tw.Next() && !tw.PathString.Equals("file"))
			{
			}
			//
			NUnit.Framework.Assert.AreEqual(WorkingTreeIterator.MetadataDiff.EQUAL, fti.CompareMetadata
				(dce));
			ObjectId fromRaw = ObjectId.FromRaw(fti.IdBuffer, fti.IdOffset);
			NUnit.Framework.Assert.AreEqual("6b584e8ece562ebffc15d38808cd6b98fc3d97ea", fromRaw
				.GetName());
			NUnit.Framework.Assert.IsFalse(fti.IsModified(dce, false));
		}
開發者ID:LunarLanding,項目名稱:ngit,代碼行數:26,代碼來源:FileTreeIteratorTest.cs


注:本文中的NGit.Treewalk.FileTreeIterator.SetDirCacheIterator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。