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


C# NGit.Tree類代碼示例

本文整理匯總了C#中NGit.Tree的典型用法代碼示例。如果您正苦於以下問題:C# Tree類的具體用法?C# Tree怎麽用?C# Tree使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Tree類屬於NGit命名空間,在下文中一共展示了Tree類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetupCase

		/// <exception cref="System.IO.IOException"></exception>
		internal virtual void SetupCase(Dictionary<string, string> headEntries, Dictionary
			<string, string> mergeEntries, Dictionary<string, string> indexEntries)
		{
			theHead = BuildTree(headEntries);
			theMerge = BuildTree(mergeEntries);
			BuildIndex(indexEntries);
		}
開發者ID:shoff,項目名稱:ngit,代碼行數:8,代碼來源:ReadTreeTest.cs

示例2: TestSimpleF1

 public virtual void TestSimpleF1()
 {
     Tree tree = new Tree(db);
     tree.AddFile("x");
     TreeIterator i = MakeIterator(tree);
     NUnit.Framework.Assert.IsTrue(i.HasNext());
     NUnit.Framework.Assert.AreEqual("x", i.Next().GetName());
 }
開發者ID:charles-cai,項目名稱:ngit,代碼行數:8,代碼來源:TreeIteratorLeafOnlyTest.cs

示例3: StartVisitTree

		/// <exception cref="System.IO.IOException"></exception>
		public virtual void StartVisitTree(Tree t)
		{
			stack.AddItem(currentDirectory);
			if (!t.IsRoot())
			{
				currentDirectory = new FilePath(currentDirectory, t.GetName());
			}
		}
開發者ID:nickname100,項目名稱:monodevelop,代碼行數:9,代碼來源:TreeVisitorWithCurrentDirectory.cs

示例4: TestEmpty

 public virtual void TestEmpty()
 {
     Tree tree = new Tree(db);
     TreeIterator i = MakeIterator(tree);
     NUnit.Framework.Assert.IsTrue(i.HasNext());
     NUnit.Framework.Assert.AreEqual(string.Empty, i.Next().GetFullName());
     NUnit.Framework.Assert.IsFalse(i.HasNext());
 }
開發者ID:charles-cai,項目名稱:ngit,代碼行數:8,代碼來源:TreeIteratorPostOrderTest.cs

示例5: IndexTreeWalker

		/// <summary>Construct a walker for the index and one tree.</summary>
		/// <remarks>Construct a walker for the index and one tree.</remarks>
		/// <param name="index"></param>
		/// <param name="tree"></param>
		/// <param name="root"></param>
		/// <param name="visitor"></param>
		public IndexTreeWalker(GitIndex index, Tree tree, FilePath root, IndexTreeVisitor
			 visitor)
		{
			//import org.eclipse.jgit.JGitText;
			this.mainTree = tree;
			this.root = root;
			this.visitor = visitor;
			this.newTree = null;
			threeTrees = false;
			indexMembers = index.GetMembers();
		}
開發者ID:famousthom,項目名稱:monodevelop,代碼行數:17,代碼來源:IndexTreeWalker.cs

示例6: PrescanTwoTrees

		/// <exception cref="System.InvalidOperationException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public override void PrescanTwoTrees(Tree head, Tree merge)
		{
			DirCache dc = db.LockDirCache();
			try
			{
				dco = new DirCacheCheckout(db, head.GetId(), dc, merge.GetId());
				dco.PreScanTwoTrees();
			}
			finally
			{
				dc.Unlock();
			}
		}
開發者ID:shoff,項目名稱:ngit,代碼行數:15,代碼來源:DirCacheCheckoutTest.cs

示例7: TestBoth

 public virtual void TestBoth()
 {
     GitIndex index = new GitIndex(db);
     Tree tree = new Tree(db);
     index.Add(trash, WriteTrashFile("a", "a"));
     tree.AddFile("b/b");
     index.Add(trash, WriteTrashFile("c", "c"));
     tree.AddFile("c");
     new IndexTreeWalker(index, tree, trash, new IndexTreeWalkerTest.TestIndexTreeVisitor
         (this)).Walk();
     NUnit.Framework.Assert.IsTrue(indexOnlyEntriesVisited.Contains("a"));
     NUnit.Framework.Assert.IsTrue(treeOnlyEntriesVisited.Contains("b/b"));
     NUnit.Framework.Assert.IsTrue(bothVisited.Contains("c"));
 }
開發者ID:charles-cai,項目名稱:ngit,代碼行數:14,代碼來源:IndexTreeWalkerTest.cs

示例8: TestRules1thru3_NoIndexEntry

		public virtual void TestRules1thru3_NoIndexEntry()
		{
			Tree head = new Tree(db);
			head = BuildTree(Mk("foo"));
			ObjectId objectId = head.FindBlobMember("foo").GetId();
			Tree merge = new Tree(db);
			PrescanTwoTrees(head, merge);
			NUnit.Framework.Assert.IsTrue(GetRemoved().Contains("foo"));
			PrescanTwoTrees(merge, head);
			NUnit.Framework.Assert.AreEqual(objectId, GetUpdated().Get("foo"));
			merge = BuildTree(Mkmap("foo", "a"));
			ObjectId anotherId = merge.FindBlobMember("foo").GetId();
			PrescanTwoTrees(head, merge);
			NUnit.Framework.Assert.AreEqual(anotherId, GetUpdated().Get("foo"));
		}
開發者ID:shoff,項目名稱:ngit,代碼行數:15,代碼來源:ReadTreeTest.cs

示例9: TestAdded

 public virtual void TestAdded()
 {
     GitIndex index = new GitIndex(db);
     WriteTrashFile("file1", "file1");
     WriteTrashFile("dir/subfile", "dir/subfile");
     Tree tree = new Tree(db);
     tree.SetId(InsertTree(tree));
     index.Add(trash, new FilePath(trash, "file1"));
     index.Add(trash, new FilePath(trash, "dir/subfile"));
     index.Write();
     FileTreeIterator iterator = new FileTreeIterator(db);
     IndexDiff diff = new IndexDiff(db, tree.GetId(), iterator);
     diff.Diff();
     NUnit.Framework.Assert.AreEqual(2, diff.GetAdded().Count);
     NUnit.Framework.Assert.IsTrue(diff.GetAdded().Contains("file1"));
     NUnit.Framework.Assert.IsTrue(diff.GetAdded().Contains("dir/subfile"));
     NUnit.Framework.Assert.AreEqual(0, diff.GetChanged().Count);
     NUnit.Framework.Assert.AreEqual(0, diff.GetModified().Count);
     NUnit.Framework.Assert.AreEqual(0, diff.GetRemoved().Count);
 }
開發者ID:ashmind,項目名稱:ngit,代碼行數:20,代碼來源:IndexDiffTest.cs

示例10: TestAdded

 public virtual void TestAdded()
 {
     WriteTrashFile("file1", "file1");
     WriteTrashFile("dir/subfile", "dir/subfile");
     Tree tree = new Tree(db);
     tree.SetId(InsertTree(tree));
     DirCache index = db.LockDirCache();
     DirCacheEditor editor = index.Editor();
     editor.Add(Add(db, trash, "file1"));
     editor.Add(Add(db, trash, "dir/subfile"));
     editor.Commit();
     FileTreeIterator iterator = new FileTreeIterator(db);
     IndexDiff diff = new IndexDiff(db, tree.GetId(), iterator);
     diff.Diff();
     NUnit.Framework.Assert.AreEqual(2, diff.GetAdded().Count);
     NUnit.Framework.Assert.IsTrue(diff.GetAdded().Contains("file1"));
     NUnit.Framework.Assert.IsTrue(diff.GetAdded().Contains("dir/subfile"));
     NUnit.Framework.Assert.AreEqual(0, diff.GetChanged().Count);
     NUnit.Framework.Assert.AreEqual(0, diff.GetModified().Count);
     NUnit.Framework.Assert.AreEqual(0, diff.GetRemoved().Count);
     NUnit.Framework.CollectionAssert.AreEquivalent(Collections<string>.EMPTY_SET, diff.GetUntrackedFolders()
         );
 }
開發者ID:sharwell,項目名稱:ngit,代碼行數:23,代碼來源:IndexDiffTest.cs

示例11: TestIndexOnlySubDirs

 public virtual void TestIndexOnlySubDirs()
 {
     GitIndex index = new GitIndex(db);
     Tree tree = new Tree(db);
     index.Add(trash, WriteTrashFile("foo/bar/baz", "foobar"));
     index.Add(trash, WriteTrashFile("asdf", "asdf"));
     new IndexTreeWalker(index, tree, trash, new IndexTreeWalkerTest.TestIndexTreeVisitor
         (this)).Walk();
     NUnit.Framework.Assert.AreEqual("asdf", indexOnlyEntriesVisited[0]);
     NUnit.Framework.Assert.AreEqual("foo/bar/baz", indexOnlyEntriesVisited[1]);
 }
開發者ID:charles-cai,項目名稱:ngit,代碼行數:11,代碼來源:IndexTreeWalkerTest.cs

示例12: Test024_createCommitNonAscii

 public virtual void Test024_createCommitNonAscii()
 {
     ObjectId emptyId = InsertEmptyBlob();
     Tree almostEmptyTree = new Tree(db);
     almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Sharpen.Runtime.GetBytesForString
         ("empty"), false));
     ObjectId almostEmptyTreeId = InsertTree(almostEmptyTree);
     NGit.CommitBuilder commit = new NGit.CommitBuilder();
     commit.TreeId = almostEmptyTreeId;
     commit.Author = new PersonIdent("Joe H\u00e4cker", "[email protected]", 4294967295000L
         , 60);
     commit.Committer = new PersonIdent("Joe Hacker", "[email protected]", 4294967295000L
         , 60);
     commit.SetEncoding("ISO-8859-1");
     commit.Message = "\u00dcbergeeks";
     ObjectId cid = InsertCommit(commit);
     NUnit.Framework.Assert.AreEqual("2979b39d385014b33287054b87f77bcb3ecb5ebf", cid.Name
         );
 }
開發者ID:JamesChan,項目名稱:ngit,代碼行數:19,代碼來源:T0003_BasicTest.cs

示例13: Test022_createCommitTag

 public virtual void Test022_createCommitTag()
 {
     ObjectId emptyId = InsertEmptyBlob();
     Tree almostEmptyTree = new Tree(db);
     almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Sharpen.Runtime.GetBytesForString
         ("empty"), false));
     ObjectId almostEmptyTreeId = InsertTree(almostEmptyTree);
     NGit.CommitBuilder almostEmptyCommit = new NGit.CommitBuilder();
     almostEmptyCommit.Author = new PersonIdent(author, 1154236443000L, -2 * 60);
     // not exactly the same
     almostEmptyCommit.Committer = new PersonIdent(author, 1154236443000L, -2 * 60);
     almostEmptyCommit.Message = "test022\n";
     almostEmptyCommit.TreeId = almostEmptyTreeId;
     ObjectId almostEmptyCommitId = InsertCommit(almostEmptyCommit);
     TagBuilder t = new TagBuilder();
     t.SetObjectId(almostEmptyCommitId, Constants.OBJ_COMMIT);
     t.SetTag("test022");
     t.SetTagger(new PersonIdent(author, 1154236443000L, -4 * 60));
     t.SetMessage("test022 tagged\n");
     ObjectId actid = InsertTag(t);
     NUnit.Framework.Assert.AreEqual("0ce2ebdb36076ef0b38adbe077a07d43b43e3807", actid
         .Name);
     RevTag mapTag = ParseTag(actid);
     NUnit.Framework.Assert.AreEqual(Constants.OBJ_COMMIT, mapTag.GetObject().Type);
     NUnit.Framework.Assert.AreEqual("test022 tagged\n", mapTag.GetFullMessage());
     NUnit.Framework.Assert.AreEqual(new PersonIdent(author, 1154236443000L, -4 * 60),
         mapTag.GetTaggerIdent());
     NUnit.Framework.Assert.AreEqual("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag
         .GetObject().Id.Name);
 }
開發者ID:JamesChan,項目名稱:ngit,代碼行數:30,代碼來源:T0003_BasicTest.cs

示例14: Test012_SubtreeExternalSorting

 public virtual void Test012_SubtreeExternalSorting()
 {
     ObjectId emptyBlob = InsertEmptyBlob();
     Tree t = new Tree(db);
     FileTreeEntry e0 = t.AddFile("a-");
     FileTreeEntry e1 = t.AddFile("a-b");
     FileTreeEntry e2 = t.AddFile("a/b");
     FileTreeEntry e3 = t.AddFile("a=");
     FileTreeEntry e4 = t.AddFile("a=b");
     e0.SetId(emptyBlob);
     e1.SetId(emptyBlob);
     e2.SetId(emptyBlob);
     e3.SetId(emptyBlob);
     e4.SetId(emptyBlob);
     Tree a = (Tree)t.FindTreeMember("a");
     a.SetId(InsertTree(a));
     NUnit.Framework.Assert.AreEqual(ObjectId.FromString("b47a8f0a4190f7572e11212769090523e23eb1ea"
         ), InsertTree(t));
 }
開發者ID:JamesChan,項目名稱:ngit,代碼行數:19,代碼來源:T0003_BasicTest.cs

示例15: WorkDirCheckout

		/// <summary>Create a checkout class for merging and checking our two trees and the index.
		/// 	</summary>
		/// <remarks>Create a checkout class for merging and checking our two trees and the index.
		/// 	</remarks>
		/// <param name="repo"></param>
		/// <param name="root">workdir</param>
		/// <param name="head"></param>
		/// <param name="index"></param>
		/// <param name="merge"></param>
		public WorkDirCheckout(Repository repo, FilePath root, Tree head, GitIndex index, 
			Tree merge) : this(repo, root, index, merge)
		{
			this.head = head;
		}
開發者ID:stewartwhaley,項目名稱:monodevelop,代碼行數:14,代碼來源:WorkDirCheckout.cs


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