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


C# GitIndex.ReadTree方法代码示例

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


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

示例1: testReadTree2

        public void testReadTree2()
        {
            // Prepare a larger tree to test some odd cases in tree writing
            var index = new GitIndex(db);
            FileInfo f1 = writeTrashFile("a/a/a/a", "data:a/a/a/a");
            FileInfo f2 = writeTrashFile("a/c/c", "data:a/c/c");
            FileInfo f3 = writeTrashFile("a/b", "data:a/b");
            FileInfo f4 = writeTrashFile("[email protected]", "data:a:b");
            FileInfo f5 = writeTrashFile("a/d", "data:a/d");
            FileInfo f6 = writeTrashFile("a.b", "data:a.b");
            index.add(trash, f1);
            index.add(trash, f2);
            index.add(trash, f3);
            index.add(trash, f4);
            index.add(trash, f5);
            index.add(trash, f6);
            index.write();
            ObjectId id = index.writeTree();
            Console.WriteLine("wrote id " + id);
            Assert.AreEqual("5e0bf0aad57706894c15fdf0681c9bc7343274fc", id.Name);
            var index2 = new GitIndex(db);

            index2.ReadTree(db.MapTree(ObjectId.FromString("5e0bf0aad57706894c15fdf0681c9bc7343274fc")));
            IList<GitIndex.Entry> members = index2.Members;
            Assert.AreEqual(6, members.Count);
            Assert.AreEqual("a.b", members[0].Name);
            Assert.AreEqual("a/a/a/a", members[1].Name);
            Assert.AreEqual("a/b", members[2].Name);
            Assert.AreEqual("a/c/c", members[3].Name);
            Assert.AreEqual("a/d", members[4].Name);
            Assert.AreEqual("[email protected]", members[5].Name);

            // reread and test
            var indexr = new GitIndex(db);
            indexr.Read();
            IList<GitIndex.Entry> membersr = indexr.Members;
            Assert.AreEqual(6, membersr.Count);
            Assert.AreEqual("a.b", membersr[0].Name);
            Assert.AreEqual("a/a/a/a", membersr[1].Name);
            Assert.AreEqual("a/b", membersr[2].Name);
            Assert.AreEqual("a/c/c", membersr[3].Name);
            Assert.AreEqual("a/d", membersr[4].Name);
            Assert.AreEqual("[email protected]", membersr[5].Name);
        }
开发者ID:jagregory,项目名称:GitSharp,代码行数:44,代码来源:T0007_Index.cs

示例2: testReadTree

        public void testReadTree()
        {
            // Prepare tree
            var index = new GitIndex(db);
            writeTrashFile("a/b", "data:a/b");
            writeTrashFile("[email protected]", "data:a:b");
            writeTrashFile("a.b", "data:a.b");
            index.add(trash, new FileInfo(Path.Combine(trash.FullName, "a/b")));
            index.add(trash, new FileInfo(Path.Combine(trash.FullName, "[email protected]")));
            index.add(trash, new FileInfo(Path.Combine(trash.FullName, "a.b")));
            index.write();

            ObjectId id = index.writeTree();
            Console.WriteLine("wrote id " + id);
            Assert.AreEqual("0036d433dc4f10ec47b61abc3ec5033c78d34f84", id.Name);
            var index2 = new GitIndex(db);

            index2.ReadTree(db.MapTree(ObjectId.FromString("0036d433dc4f10ec47b61abc3ec5033c78d34f84")));
            IList<GitIndex.Entry> members = index2.Members;
            Assert.AreEqual(3, members.Count);
            Assert.AreEqual("a.b", members[0].Name);
            Assert.AreEqual("a/b", members[1].Name);
            Assert.AreEqual("[email protected]", members[2].Name);
            Assert.AreEqual(3, members.Count);

            var indexr = new GitIndex(db);
            indexr.Read();
            IList<GitIndex.Entry> membersr = indexr.Members;
            Assert.AreEqual(3, membersr.Count);
            Assert.AreEqual("a.b", membersr[0].Name);
            Assert.AreEqual("a/b", membersr[1].Name);
            Assert.AreEqual("[email protected]", membersr[2].Name);
            Assert.AreEqual(3, membersr.Count);

            if (CanRunGitStatus)
            {
                Assert.AreEqual(0, System(trash, "git status"));
            }
        }
开发者ID:jagregory,项目名称:GitSharp,代码行数:39,代码来源:T0007_Index.cs

示例3: testCheckout

        public void testCheckout()
        {
            // Prepare tree, remote it and checkout
            var index = new GitIndex(db);
            FileInfo aslashb = writeTrashFile("a/b", "data:a/b");
            FileInfo acolonb = writeTrashFile("[email protected]", "data:a:b");
            FileInfo adotb = writeTrashFile("a.b", "data:a.b");
            index.add(trash, aslashb);
            index.add(trash, acolonb);
            index.add(trash, adotb);
            index.write();
            index.writeTree();
            Delete(aslashb);
            Delete(acolonb);
            Delete(adotb);
            Delete(Directory.GetParent(aslashb.FullName));

            var index2 = new GitIndex(db);
            Assert.AreEqual(0, index2.Members.Count);

            index2.ReadTree(db.MapTree(ObjectId.FromString("0036d433dc4f10ec47b61abc3ec5033c78d34f84")));

            index2.checkout(trash);
            Assert.AreEqual("data:a/b", Content(aslashb));
            Assert.AreEqual("data:a:b", Content(acolonb));
            Assert.AreEqual("data:a.b", Content(adotb));

            if (CanRunGitStatus)
            {
                Assert.AreEqual(0, System(trash, "git status"));
            }
        }
开发者ID:jagregory,项目名称:GitSharp,代码行数:32,代码来源:T0007_Index.cs

示例4: testReadTree2

        public void testReadTree2()
        {
            // Prepare a larger tree to test some odd cases in tree writing
            var index = new GitIndex(db);
            FileInfo f1 = writeTrashFile("a/a/a/a", "data:a/a/a/a");
            FileInfo f2 = writeTrashFile("a/c/c", "data:a/c/c");
            FileInfo f3 = writeTrashFile("a/b", "data:a/b");
            FileInfo f4 = writeTrashFile("a:b", "data:a:b");
            FileInfo f5 = writeTrashFile("a/d", "data:a/d");
            FileInfo f6 = writeTrashFile("a.b", "data:a.b");
            index.add(trash, f1);
            index.add(trash, f2);
            index.add(trash, f3);
            index.add(trash, f4);
            index.add(trash, f5);
            index.add(trash, f6);
            index.write();
            ObjectId id = index.writeTree();
            Console.WriteLine("wrote id " + id);
            Assert.AreEqual("ba78e065e2c261d4f7b8f42107588051e87e18e9", id.Name);
            var index2 = new GitIndex(db);

            index2.ReadTree(db.MapTree(ObjectId.FromString("ba78e065e2c261d4f7b8f42107588051e87e18e9")));
            GitIndex.Entry[] members = index2.Members;
            Assert.AreEqual(6, members.Length);
            Assert.AreEqual("a.b", members[0].Name);
            Assert.AreEqual("a/a/a/a", members[1].Name);
            Assert.AreEqual("a/b", members[2].Name);
            Assert.AreEqual("a/c/c", members[3].Name);
            Assert.AreEqual("a/d", members[4].Name);
            Assert.AreEqual("a:b", members[5].Name);

            // reread and test
            var indexr = new GitIndex(db);
            indexr.Read();
            GitIndex.Entry[] membersr = indexr.Members;
            Assert.AreEqual(6, membersr.Length);
            Assert.AreEqual("a.b", membersr[0].Name);
            Assert.AreEqual("a/a/a/a", membersr[1].Name);
            Assert.AreEqual("a/b", membersr[2].Name);
            Assert.AreEqual("a/c/c", membersr[3].Name);
            Assert.AreEqual("a/d", membersr[4].Name);
            Assert.AreEqual("a:b", membersr[5].Name);
        }
开发者ID:HackerBaloo,项目名称:GitSharp,代码行数:44,代码来源:IndexTests.cs

示例5: testReadTree

        public void testReadTree()
        {
            // Prepare tree
            var index = new GitIndex(db);
            writeTrashFile("a/b", "data:a/b");
            writeTrashFile("a:b", "data:a:b");
            writeTrashFile("a.b", "data:a.b");
            index.add(trash, new FileInfo(Path.Combine(trash.FullName, "a/b")));
            index.add(trash, new FileInfo(Path.Combine(trash.FullName, "a:b")));
            index.add(trash, new FileInfo(Path.Combine(trash.FullName, "a.b")));
            index.write();

            ObjectId id = index.writeTree();
            Console.WriteLine("wrote id " + id);
            Assert.AreEqual("c696abc3ab8e091c665f49d00eb8919690b3aec3", id.Name);
            var index2 = new GitIndex(db);

            index2.ReadTree(db.MapTree(ObjectId.FromString("c696abc3ab8e091c665f49d00eb8919690b3aec3")));
            GitIndex.Entry[] members = index2.Members;
            Assert.AreEqual(3, members.Length);
            Assert.AreEqual("a.b", members[0].Name);
            Assert.AreEqual("a/b", members[1].Name);
            Assert.AreEqual("a:b", members[2].Name);
            Assert.AreEqual(3, members.Length);

            var indexr = new GitIndex(db);
            indexr.Read();
            GitIndex.Entry[] membersr = indexr.Members;
            Assert.AreEqual(3, membersr.Length);
            Assert.AreEqual("a.b", membersr[0].Name);
            Assert.AreEqual("a/b", membersr[1].Name);
            Assert.AreEqual("a:b", membersr[2].Name);
            Assert.AreEqual(3, membersr.Length);

            if (CanRunGitStatus)
            {
                Assert.AreEqual(0, System(trash, "git status"));
            }
        }
开发者ID:HackerBaloo,项目名称:GitSharp,代码行数:39,代码来源:IndexTests.cs

示例6: testCheckout

        public void testCheckout()
        {
            // Prepare tree, remote it and checkout
            var index = new GitIndex(db);
            FileInfo aslashb = writeTrashFile("a/b", "data:a/b");
            FileInfo acolonb = writeTrashFile("a:b", "data:a:b");
            FileInfo adotb = writeTrashFile("a.b", "data:a.b");
            index.add(trash, aslashb);
            index.add(trash, acolonb);
            index.add(trash, adotb);
            index.write();
            index.writeTree();
            Delete(aslashb);
            Delete(acolonb);
            Delete(adotb);
            Delete(Directory.GetParent(aslashb.FullName));

            var index2 = new GitIndex(db);
            Assert.AreEqual(0, index2.Members.Length);

            index2.ReadTree(db.MapTree(ObjectId.FromString("c696abc3ab8e091c665f49d00eb8919690b3aec3")));

            index2.checkout(trash);
            Assert.AreEqual("data:a/b", Content(aslashb));
            Assert.AreEqual("data:a:b", Content(acolonb));
            Assert.AreEqual("data:a.b", Content(adotb));

            if (CanRunGitStatus)
            {
                Assert.AreEqual(0, System(trash, "git status"));
            }
        }
开发者ID:HackerBaloo,项目名称:GitSharp,代码行数:32,代码来源:IndexTests.cs


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