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


C# Tree.findTreeMember方法代码示例

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


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

示例1: test006_addDeepTree

        public void test006_addDeepTree()
        {
            var t = new Tree(db);

            Tree e = t.AddTree("e");
            Assert.IsNotNull(e);
            Assert.IsTrue(e.Parent == t);
            Tree f = t.AddTree("f");
            Assert.IsNotNull(f);
            Assert.IsTrue(f.Parent == t);
            Tree g = f.AddTree("g");
            Assert.IsNotNull(g);
            Assert.IsTrue(g.Parent == f);
            Tree h = g.AddTree("h");
            Assert.IsNotNull(h);
            Assert.IsTrue(h.Parent == g);

            h.Id = SomeFakeId;
            Assert.IsTrue(!h.IsModified);
            g.Id = SomeFakeId;
            Assert.IsTrue(!g.IsModified);
            f.Id = SomeFakeId;
            Assert.IsTrue(!f.IsModified);
            e.Id = SomeFakeId;
            Assert.IsTrue(!e.IsModified);
            t.Id = SomeFakeId;
            Assert.IsTrue(!t.IsModified);

            Assert.AreEqual("f/g/h", h.FullName);
            Assert.IsTrue(t.findTreeMember(h.FullName) == h);
            Assert.IsTrue(t.FindBlobMember("f/z") == null);
            Assert.IsTrue(t.FindBlobMember("y/z") == null);

            FileTreeEntry i = h.AddFile("i");
            Assert.IsNotNull(i);
            Assert.AreEqual("f/g/h/i", i.FullName);
            Assert.IsTrue(t.FindBlobMember(i.FullName) == i);
            Assert.IsTrue(h.IsModified);
            Assert.IsTrue(g.IsModified);
            Assert.IsTrue(f.IsModified);
            Assert.IsTrue(!e.IsModified);
            Assert.IsTrue(t.IsModified);

            Assert.IsTrue(h.Id == null);
            Assert.IsTrue(g.Id == null);
            Assert.IsTrue(f.Id == null);
            Assert.IsTrue(e.Id != null);
            Assert.IsTrue(t.Id == null);
        }
开发者ID:georgeck,项目名称:GitSharp,代码行数:49,代码来源:T0002_Tree.cs

示例2: test004_addTree

        public void test004_addTree()
        {
            var t = new Tree(db) {Id = SomeFakeId};
            Assert.IsTrue(t.Id != null);
            Assert.IsFalse(t.IsModified);

            const string n = "bob";
            Tree f = t.AddTree(n);
            Assert.IsNotNull(f);
            Assert.AreEqual(n, f.Name);
            Assert.AreEqual(f.Name, Constants.CHARSET.GetString(f.NameUTF8));
            Assert.AreEqual(n, f.FullName);
            Assert.IsTrue(f.Id == null);
            Assert.IsTrue(f.Parent == t);
            Assert.IsTrue(f.Repository == db);
            Assert.IsTrue(f.IsLoaded);
            Assert.IsFalse(f.Members.Length > 0);
            Assert.IsFalse(f.IsRoot);
            Assert.IsTrue(f.TreeEntry == f);
            Assert.IsTrue(t.IsModified);
            Assert.IsTrue(t.Id == null);
            Assert.IsTrue(t.findTreeMember(f.Name) == f);

            TreeEntry[] i = t.Members;
            Assert.IsTrue(i.Length > 0);
            Assert.IsTrue(i[0] == f);
            Assert.IsTrue(i.Length == 1);
        }
开发者ID:georgeck,项目名称:GitSharp,代码行数:28,代码来源:T0002_Tree.cs

示例3: test001_createEmpty

 public void test001_createEmpty()
 {
     var t = new Tree(db);
     Assert.IsTrue(t.IsLoaded);
     Assert.IsTrue(t.IsModified);
     Assert.IsTrue(t.Parent == null);
     Assert.IsTrue(t.IsRoot);
     Assert.IsTrue(t.Name == null);
     Assert.IsTrue(t.NameUTF8 == null);
     Assert.IsTrue(t.Members != null);
     Assert.IsTrue(t.Members.Length == 0);
     Assert.AreEqual(string.Empty, t.FullName);
     Assert.IsTrue(t.Id == null);
     Assert.IsTrue(t.TreeEntry == t);
     Assert.IsTrue(t.Repository == db);
     Assert.IsTrue(t.findTreeMember("foo") == null);
     Assert.IsTrue(t.FindBlobMember("foo") == null);
 }
开发者ID:georgeck,项目名称:GitSharp,代码行数:18,代码来源:T0002_Tree.cs

示例4: testModified

        public void testModified()
        {
            var index = new GitIndex(db);

            index.add(trash, writeTrashFile("file2", "file2"));
            index.add(trash, writeTrashFile("dir/file3", "dir/file3"));

            writeTrashFile("dir/file3", "changed");

            var t = new Tree(db);
            t.AddFile("file2").Id = ObjectId.FromString("0123456789012345678901234567890123456789");
            t.AddFile("dir/file3").Id = ObjectId.FromString("0123456789012345678901234567890123456789");
            Assert.AreEqual(2, t.MemberCount);

            var tree2 = (Tree) t.findTreeMember("dir");
            tree2.Id = new ObjectWriter(db).WriteTree(tree2);
            t.Id = new ObjectWriter(db).WriteTree(t);
            var diff = new IndexDiff(t, index);
            diff.Diff();
            Assert.AreEqual(2, diff.Changed.Count);
            Assert.IsTrue(diff.Changed.Contains("file2"));
            Assert.IsTrue(diff.Changed.Contains("dir/file3"));
            Assert.AreEqual(1, diff.Modified.Count);
            Assert.IsTrue(diff.Modified.Contains("dir/file3"));
            Assert.AreEqual(0, diff.Added.Count);
            Assert.AreEqual(0, diff.Removed.Count);
            Assert.AreEqual(0, diff.Missing.Count);
        }
开发者ID:georgeck,项目名称:GitSharp,代码行数:28,代码来源:IndexDiffTest.cs

示例5: testUnchangedComplex

        public void testUnchangedComplex()
        {
            var index = new GitIndex(db);
            index.add(trash, writeTrashFile("a.b", "a.b"));
            index.add(trash, writeTrashFile("a.c", "a.c"));
            index.add(trash, writeTrashFile("a/b.b/b", "a/b.b/b"));
            index.add(trash, writeTrashFile("a/b", "a/b"));
            index.add(trash, writeTrashFile("a/c", "a/c"));
            index.add(trash, writeTrashFile("a=c", "a=c"));
            index.add(trash, writeTrashFile("a=d", "a=d"));

            var t = new Tree(db);
            t.AddFile("a.b").Id = ObjectId.FromString("f6f28df96c2b40c951164286e08be7c38ec74851");
            t.AddFile("a.c").Id = ObjectId.FromString("6bc0e647512d2a0bef4f26111e484dc87df7f5ca");
            t.AddFile("a/b.b/b").Id = ObjectId.FromString("8d840bd4e2f3a48ff417c8e927d94996849933fd");
            t.AddFile("a/b").Id = ObjectId.FromString("db89c972fc57862eae378f45b74aca228037d415");
            t.AddFile("a/c").Id = ObjectId.FromString("52ad142a008aeb39694bafff8e8f1be75ed7f007");
            t.AddFile("a=c").Id = ObjectId.FromString("06022365ddbd7fb126761319633bf73517770714");
            t.AddFile("a=d").Id = ObjectId.FromString("fa6414df3da87840700e9eeb7fc261dd77ccd5c2");

            var tree2 = (Tree) t.findTreeMember("a/b.b");
            tree2.Id = new ObjectWriter(db).WriteTree(tree2);

            var tree3 = (Tree) t.findTreeMember("a");
            tree3.Id = new ObjectWriter(db).WriteTree(tree3);
            t.Id = new ObjectWriter(db).WriteTree(t);

            var diff = new IndexDiff(t, index);
            diff.Diff();

            Assert.AreEqual(0, diff.Changed.Count);
            Assert.AreEqual(0, diff.Added.Count);
            Assert.AreEqual(0, diff.Removed.Count);
            Assert.AreEqual(0, diff.Missing.Count);
            Assert.AreEqual(0, diff.Modified.Count);
        }
开发者ID:georgeck,项目名称:GitSharp,代码行数:36,代码来源:IndexDiffTest.cs

示例6: testRemoved

        public void testRemoved()
        {
            var index = new GitIndex(db);
            writeTrashFile("file2", "file2");
            writeTrashFile("dir/file3", "dir/file3");

            var t = new Tree(db);
            t.AddFile("file2");
            t.AddFile("dir/file3");
            Assert.AreEqual(2, t.MemberCount);
            t.FindBlobMember("file2").Id = ObjectId.FromString("30d67d4672d5c05833b7192cc77a79eaafb5c7ad");
            var tree2 = (Tree) t.findTreeMember("dir");
            tree2.FindBlobMember("file3").Id = ObjectId.FromString("873fb8d667d05436d728c52b1d7a09528e6eb59b");
            tree2.Id = new ObjectWriter(db).WriteTree(tree2);
            t.Id = new ObjectWriter(db).WriteTree(t);

            var diff = new IndexDiff(t, index);
            diff.Diff();
            Assert.AreEqual(2, diff.Removed.Count);
            Assert.IsTrue(diff.Removed.Contains("file2"));
            Assert.IsTrue(diff.Removed.Contains("dir/file3"));
            Assert.AreEqual(0, diff.Changed.Count);
            Assert.AreEqual(0, diff.Modified.Count);
            Assert.AreEqual(0, diff.Added.Count);
        }
开发者ID:georgeck,项目名称:GitSharp,代码行数:25,代码来源:IndexDiffTest.cs


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