• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# NGit.Tree类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NGit.Tree的典型用法代码示例。如果您正苦于以下问题:C# Tree类的具体用法?C# Tree怎么用?C# Tree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Tree类属于NGit命名空间,在下文中一共展示了Tree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: MakeIterator

 private TreeIterator MakeIterator(Tree tree)
 {
     return new TreeIterator(tree);
 }
开发者ID:charles-cai,项目名称:ngit,代码行数:4,代码来源:TreeIteratorLeafOnlyTest.cs


示例17: TestEmpty

 public virtual void TestEmpty()
 {
     Tree tree = new Tree(db);
     TreeIterator i = MakeIterator(tree);
     NUnit.Framework.Assert.IsFalse(i.HasNext());
 }
开发者ID:charles-cai,项目名称:ngit,代码行数:6,代码来源:TreeIteratorLeafOnlyTest.cs


示例18: FinishVisitTree

			/// <exception cref="System.IO.IOException"></exception>
			public override void FinishVisitTree(Tree tree, Tree auxTree, string curDir)
			{
				if (curDir.Length == 0)
				{
					return;
				}
				if (auxTree != null)
				{
					if (this._enclosing.index.GetEntry(curDir) != null)
					{
						this._enclosing.removed.AddItem(curDir);
					}
				}
			}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:15,代码来源:WorkDirCheckout.cs


示例19: TestSimpleT

 public virtual void TestSimpleT()
 {
     Tree tree = new Tree(db);
     tree.AddTree("a");
     TreeIterator i = MakeIterator(tree);
     NUnit.Framework.Assert.IsFalse(i.HasNext());
 }
开发者ID:charles-cai,项目名称:ngit,代码行数:7,代码来源:TreeIteratorLeafOnlyTest.cs


示例20: HasParentBlob

		/// <exception cref="System.IO.IOException"></exception>
		private bool HasParentBlob(Tree t, string name)
		{
			if (name.IndexOf("/") == -1)
			{
				return false;
			}
			string parent = Sharpen.Runtime.Substring(name, 0, name.LastIndexOf("/"));
			if (t.FindBlobMember(parent) != null)
			{
				return true;
			}
			return HasParentBlob(t, parent);
		}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:14,代码来源:WorkDirCheckout.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Api.Git类代码示例发布时间:2022-05-26
下一篇:
C# NGit.ProgressMonitor类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap