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


C# GitIndex.GetEntry方法代码示例

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


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

示例1: ShouldSupportNotModifiedExtensionlessFilesWithoutContentChecking

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

			writeTrashFile("extensionless-file", "contents");

			var file = new FileInfo(Path.Combine(trash.FullName, "extensionless-file"));

			index.add(trash, file);

			var entry = index.GetEntry("extensionless-file");

			Assert.IsFalse(entry.IsModified(trash));
		}
开发者ID:dev218,项目名称:GitSharp,代码行数:14,代码来源:IndexModifiedTests.cs

示例2: ShouldAllowComparingOfAlreadyOpenedFile

		public void ShouldAllowComparingOfAlreadyOpenedFile()
		{
			var index = new GitIndex(db);
			var file = writeTrashFile("extensionless-file", "contents");

			index.add(trash, file);

			var entry = index.GetEntry("extensionless-file");

			// [henon] failed on my windows box (originally only observed on mono/unix) when executed in resharper or with nunit without waiting a second!
			// as the timing is not the point of the test here let's wait a sec anyway.
			Thread.Sleep(TimeSpan.FromSeconds(1));

			// replace contents of file (with same size so it passes the size check)
			using (var writer = file.CreateText())
				writer.Write("stnetnoc");

			// opening the file for reading shoudn't block us from checking the contents
			using (file.OpenRead())
				Assert.IsTrue(entry.IsModified(trash, true));
		}
开发者ID:dev218,项目名称:GitSharp,代码行数:21,代码来源:IndexModifiedTests.cs

示例3: ShouldAllowComparingOfAlreadyOpenedFile

        public void ShouldAllowComparingOfAlreadyOpenedFile()
        {
            var index = new GitIndex(db);
            var file = writeTrashFile("extensionless-file", "contents");

            index.add(trash, file);

            var entry = index.GetEntry("extensionless-file");

            if (AssertHelper.IsRunningOnMono())
            {
                // File timestamps on Unix based systems are only precise to the second
                Thread.Sleep(TimeSpan.FromSeconds(1));
            }

            // replace contents of file (with same size so it passes the size check)
            using (var writer = file.CreateText())
                writer.Write("stnetnoc");

            // opening the file for reading shoudn't block us from checking the contents
            using (file.OpenRead())
                Assert.IsTrue(entry.IsModified(trash, true));
        }
开发者ID:jagregory,项目名称:GitSharp,代码行数:23,代码来源:IndexModifiedTests.cs

示例4: TestCheckingOutWithConflicts

 public virtual void TestCheckingOutWithConflicts()
 {
     GitIndex index = new GitIndex(db);
     index.Add(trash, WriteTrashFile("bar", "bar"));
     index.Add(trash, WriteTrashFile("foo/bar/baz/qux", "foo/bar"));
     RecursiveDelete(new FilePath(trash, "bar"));
     RecursiveDelete(new FilePath(trash, "foo"));
     WriteTrashFile("bar/baz/qux/foo", "another nasty one");
     WriteTrashFile("foo", "troublesome little bugger");
     try
     {
         WorkDirCheckout workDirCheckout = new WorkDirCheckout(db, trash, index, index);
         workDirCheckout.Checkout();
         NUnit.Framework.Assert.Fail("Should have thrown exception");
     }
     catch (NGit.Errors.CheckoutConflictException)
     {
     }
     // all is well
     WorkDirCheckout workDirCheckout_1 = new WorkDirCheckout(db, trash, index, index);
     workDirCheckout_1.SetFailOnConflict(false);
     workDirCheckout_1.Checkout();
     NUnit.Framework.Assert.IsTrue(new FilePath(trash, "bar").IsFile());
     NUnit.Framework.Assert.IsTrue(new FilePath(trash, "foo/bar/baz/qux").IsFile());
     GitIndex index2 = new GitIndex(db);
     RecursiveDelete(new FilePath(trash, "bar"));
     RecursiveDelete(new FilePath(trash, "foo"));
     index2.Add(trash, WriteTrashFile("bar/baz/qux/foo", "bar"));
     WriteTrashFile("bar/baz/qux/bar", "evil? I thought it said WEEVIL!");
     index2.Add(trash, WriteTrashFile("foo", "lalala"));
     workDirCheckout_1 = new WorkDirCheckout(db, trash, index2, index);
     workDirCheckout_1.SetFailOnConflict(false);
     workDirCheckout_1.Checkout();
     NUnit.Framework.Assert.IsTrue(new FilePath(trash, "bar").IsFile());
     NUnit.Framework.Assert.IsTrue(new FilePath(trash, "foo/bar/baz/qux").IsFile());
     NUnit.Framework.Assert.IsNotNull(index2.GetEntry("bar"));
     NUnit.Framework.Assert.IsNotNull(index2.GetEntry("foo/bar/baz/qux"));
     NUnit.Framework.Assert.IsNull(index2.GetEntry("bar/baz/qux/foo"));
     NUnit.Framework.Assert.IsNull(index2.GetEntry("foo"));
 }
开发者ID:charles-cai,项目名称:ngit,代码行数:40,代码来源:WorkDirCheckoutTest.cs

示例5: testCreateSimpleSortTestIndex

        public void testCreateSimpleSortTestIndex()
        {
            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();

            Assert.AreEqual("a/b", index.GetEntry("a/b").Name);
            Assert.AreEqual("[email protected]", index.GetEntry("[email protected]").Name);
            Assert.AreEqual("a.b", index.GetEntry("a.b").Name);
            Assert.IsNull(index.GetEntry("a*b"));

            // Repeat test for re-Read index
            var indexr = new GitIndex(db);
            indexr.Read();
            Assert.AreEqual("a/b", indexr.GetEntry("a/b").Name);
            Assert.AreEqual("[email protected]", indexr.GetEntry("[email protected]").Name);
            Assert.AreEqual("a.b", indexr.GetEntry("a.b").Name);
            Assert.IsNull(indexr.GetEntry("a*b"));

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

示例6: testCheckingOutWithConflicts

        public void testCheckingOutWithConflicts()
        {
            var index = new GitIndex(db);
            index.add(trash, writeTrashFile("bar", "bar"));
            index.add(trash, writeTrashFile("foo/bar/baz/qux", "foo/bar"));
            recursiveDelete(new FileInfo(Path.Combine(trash.FullName, "bar")));
            recursiveDelete(new DirectoryInfo(Path.Combine(trash.FullName, "foo")));
            writeTrashFile("bar/baz/qux/foo", "another nasty one");
            writeTrashFile("foo", "troublesome little bugger");

            var workDirCheckout1 = new WorkDirCheckout(db, trash, index, index);

            AssertHelper.Throws<CheckoutConflictException>(workDirCheckout1.checkout);

            var workDirCheckout2 = new WorkDirCheckout(db, trash, index, index) { FailOnConflict = false };
            workDirCheckout2.checkout();

            Assert.IsTrue(new FileInfo(Path.Combine(trash.FullName, "bar")).IsFile());
            Assert.IsTrue(new FileInfo(Path.Combine(trash.FullName, "foo/bar/baz/qux")).IsFile());

            var index2 = new GitIndex(db);
            recursiveDelete(new FileInfo(Path.Combine(trash.FullName, "bar")));
            recursiveDelete(new DirectoryInfo(Path.Combine(trash.FullName, "foo")));
            index2.add(trash, writeTrashFile("bar/baz/qux/foo", "bar"));
            writeTrashFile("bar/baz/qux/bar", "evil? I thought it said WEEVIL!");
            index2.add(trash, writeTrashFile("foo", "lalala"));

            workDirCheckout2 = new WorkDirCheckout(db, trash, index2, index) { FailOnConflict = false };
            workDirCheckout2.checkout();

            Assert.IsTrue(new FileInfo(Path.Combine(trash.FullName, "bar")).IsFile());
            Assert.IsTrue(new FileInfo(Path.Combine(trash.FullName, "foo/bar/baz/qux")).IsFile());
            Assert.IsNotNull(index2.GetEntry("bar"));
            Assert.IsNotNull(index2.GetEntry("foo/bar/baz/qux"));
            Assert.IsNull(index2.GetEntry("bar/baz/qux/foo"));
            Assert.IsNull(index2.GetEntry("foo"));
        }
开发者ID:jagregory,项目名称:GitSharp,代码行数:37,代码来源:WorkDirCheckoutTest.cs


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