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


C# Tree.FindBlobMember方法代码示例

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


在下文中一共展示了Tree.FindBlobMember方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: 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

示例3: Test006_addDeepTree

		public virtual void Test006_addDeepTree()
		{
			Tree t = new Tree(db);
			Tree e = t.AddTree("e");
			NUnit.Framework.Assert.IsNotNull(e, "have e");
			NUnit.Framework.Assert.IsTrue(e.GetParent() == t, "e.parent == t");
			Tree f = t.AddTree("f");
			NUnit.Framework.Assert.IsNotNull(f, "have f");
			NUnit.Framework.Assert.IsTrue(f.GetParent() == t, "f.parent == t");
			Tree g = f.AddTree("g");
			NUnit.Framework.Assert.IsNotNull(g, "have g");
			NUnit.Framework.Assert.IsTrue(g.GetParent() == f, "g.parent == f");
			Tree h = g.AddTree("h");
			NUnit.Framework.Assert.IsNotNull(h, "have h");
			NUnit.Framework.Assert.IsTrue(h.GetParent() == g, "h.parent = g");
			h.SetId(SOME_FAKE_ID);
			NUnit.Framework.Assert.IsTrue(!h.IsModified(), "h not modified");
			g.SetId(SOME_FAKE_ID);
			NUnit.Framework.Assert.IsTrue(!g.IsModified(), "g not modified");
			f.SetId(SOME_FAKE_ID);
			NUnit.Framework.Assert.IsTrue(!f.IsModified(), "f not modified");
			e.SetId(SOME_FAKE_ID);
			NUnit.Framework.Assert.IsTrue(!e.IsModified(), "e not modified");
			t.SetId(SOME_FAKE_ID);
			NUnit.Framework.Assert.IsTrue(!t.IsModified(), "t not modified.");
			NUnit.Framework.Assert.AreEqual("f/g/h", h.GetFullName(), "full path of h ok");
			NUnit.Framework.Assert.IsTrue(t.FindTreeMember(h.GetFullName()) == h, "Can find h"
				);
			NUnit.Framework.Assert.IsTrue(t.FindBlobMember("f/z") == null, "Can't find f/z");
			NUnit.Framework.Assert.IsTrue(t.FindBlobMember("y/z") == null, "Can't find y/z");
			FileTreeEntry i = h.AddFile("i");
			NUnit.Framework.Assert.IsNotNull(i);
			NUnit.Framework.Assert.AreEqual("f/g/h/i", i.GetFullName(), "full path of i ok");
			NUnit.Framework.Assert.IsTrue(t.FindBlobMember(i.GetFullName()) == i, "Can find i"
				);
			NUnit.Framework.Assert.IsTrue(h.IsModified(), "h modified");
			NUnit.Framework.Assert.IsTrue(g.IsModified(), "g modified");
			NUnit.Framework.Assert.IsTrue(f.IsModified(), "f modified");
			NUnit.Framework.Assert.IsTrue(!e.IsModified(), "e not modified");
			NUnit.Framework.Assert.IsTrue(t.IsModified(), "t modified");
			NUnit.Framework.Assert.IsTrue(h.GetId() == null, "h no id");
			NUnit.Framework.Assert.IsTrue(g.GetId() == null, "g no id");
			NUnit.Framework.Assert.IsTrue(f.GetId() == null, "f no id");
			NUnit.Framework.Assert.IsTrue(e.GetId() != null, "e has id");
			NUnit.Framework.Assert.IsTrue(t.GetId() == null, "t no id");
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:46,代码来源:T0002_TreeTest.cs

示例4: Test002_addFile

		public virtual void Test002_addFile()
		{
			Tree t = new Tree(db);
			t.SetId(SOME_FAKE_ID);
			NUnit.Framework.Assert.IsTrue(t.GetId() != null, "has id");
			NUnit.Framework.Assert.IsFalse(t.IsModified(), "not modified");
			string n = "bob";
			FileTreeEntry f = t.AddFile(n);
			NUnit.Framework.Assert.IsNotNull(f, "have file");
			NUnit.Framework.Assert.AreEqual(n, f.GetName(), "name matches");
			NUnit.Framework.Assert.AreEqual(f.GetName(), Sharpen.Runtime.GetStringForBytes(f.
				GetNameUTF8(), "UTF-8"), "name matches");
			NUnit.Framework.Assert.AreEqual(n, f.GetFullName(), "full name matches");
			NUnit.Framework.Assert.IsTrue(f.GetId() == null, "no id");
			NUnit.Framework.Assert.IsTrue(t.IsModified(), "is modified");
			NUnit.Framework.Assert.IsTrue(t.GetId() == null, "has no id");
			NUnit.Framework.Assert.IsTrue(t.FindBlobMember(f.GetName()) == f, "found bob");
			TreeEntry[] i = t.Members();
			NUnit.Framework.Assert.IsNotNull(i, "members array not null");
			NUnit.Framework.Assert.IsTrue(i != null && i.Length > 0, "iterator is not empty");
			NUnit.Framework.Assert.IsTrue(i != null && i[0] == f, "iterator returns file");
			NUnit.Framework.Assert.IsTrue(i != null && i.Length == 1, "iterator is empty");
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:23,代码来源:T0002_TreeTest.cs

示例5: Test001_createEmpty

		public virtual void Test001_createEmpty()
		{
			Tree t = new Tree(db);
			NUnit.Framework.Assert.IsTrue(t.IsLoaded(), "isLoaded");
			NUnit.Framework.Assert.IsTrue(t.IsModified(), "isModified");
			NUnit.Framework.Assert.IsTrue(t.GetParent() == null, "no parent");
			NUnit.Framework.Assert.IsTrue(t.IsRoot(), "isRoot");
			NUnit.Framework.Assert.IsTrue(t.GetName() == null, "no name");
			NUnit.Framework.Assert.IsTrue(t.GetNameUTF8() == null, "no nameUTF8");
			NUnit.Framework.Assert.IsTrue(t.Members() != null, "has entries array");
			NUnit.Framework.Assert.AreEqual(0, t.Members().Length, "entries is empty");
			NUnit.Framework.Assert.AreEqual(string.Empty, t.GetFullName(), "full name is empty"
				);
			NUnit.Framework.Assert.IsTrue(t.GetId() == null, "no id");
			NUnit.Framework.Assert.IsTrue(t.GetRepository() == db, "database is r");
			NUnit.Framework.Assert.IsTrue(t.FindTreeMember("foo") == null, "no foo child");
			NUnit.Framework.Assert.IsTrue(t.FindBlobMember("foo") == null, "no foo child");
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:18,代码来源:T0002_TreeTest.cs

示例6: TestRemoved

 public virtual void TestRemoved()
 {
     WriteTrashFile("file2", "file2");
     WriteTrashFile("dir/file3", "dir/file3");
     Tree tree = new Tree(db);
     tree.AddFile("file2");
     tree.AddFile("dir/file3");
     NUnit.Framework.Assert.AreEqual(2, tree.MemberCount());
     tree.FindBlobMember("file2").SetId(ObjectId.FromString("30d67d4672d5c05833b7192cc77a79eaafb5c7ad"
         ));
     Tree tree2 = (Tree)tree.FindTreeMember("dir");
     tree2.FindBlobMember("file3").SetId(ObjectId.FromString("873fb8d667d05436d728c52b1d7a09528e6eb59b"
         ));
     tree2.SetId(InsertTree(tree2));
     tree.SetId(InsertTree(tree));
     FileTreeIterator iterator = new FileTreeIterator(db);
     IndexDiff diff = new IndexDiff(db, tree.GetId(), iterator);
     diff.Diff();
     NUnit.Framework.Assert.AreEqual(2, diff.GetRemoved().Count);
     NUnit.Framework.Assert.IsTrue(diff.GetRemoved().Contains("file2"));
     NUnit.Framework.Assert.IsTrue(diff.GetRemoved().Contains("dir/file3"));
     NUnit.Framework.Assert.AreEqual(0, diff.GetChanged().Count);
     NUnit.Framework.Assert.AreEqual(0, diff.GetModified().Count);
     NUnit.Framework.Assert.AreEqual(0, diff.GetAdded().Count);
     NUnit.Framework.CollectionAssert.AreEquivalent(Collections<string>.EMPTY_SET, diff.GetUntrackedFolders()
         );
 }
开发者ID:sharwell,项目名称:ngit,代码行数:27,代码来源:IndexDiffTest.cs

示例7: UnStageFile

        /// <summary>
        /// Requires absolute path
        /// </summary>
        /// <param name="fileName"></param>
        public void UnStageFile(string fileName)
        {
            if (!this.HasGitRepository) return;

            var fileNameRel = GetRelativeFileName(fileName);
            var head = repository.Resolve(Constants.HEAD);

            Tree commitTree = null;
            TreeEntry treeEntry = null;
            if (head == null)
            {
                commitTree = new Tree(repository);
            }
            else
            {
                var revTree = new RevWalk(repository).ParseTree(head);
                var treeId = revTree.Id;
                commitTree = new Tree(repository, treeId, repository.Open(treeId).GetBytes());
                if(commitTree!=null) treeEntry = commitTree.FindBlobMember(fileNameRel);
            }
            var index = repository.GetIndex();
            index.RereadIfNecessary();
            index.Remove(repository.WorkTree, fileName);

            if (treeEntry != null)
            {
                index.AddEntry(treeEntry);
            }

            index.Write();

            this.cache.Remove(GetCacheKey(fileName));
        }
开发者ID:Miraculix,项目名称:Git-Source-Control-Provider,代码行数:37,代码来源:GitFileStatusTracker.cs


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