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

C# DirectoryCache.DirCacheEntry类代码示例

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

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



DirCacheEntry类属于GitSharp.Core.DirectoryCache命名空间,在下文中一共展示了DirCacheEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: testNonRecursiveFiltering

        public void testNonRecursiveFiltering()
        {
            var ow = new ObjectWriter(db);
            ObjectId aSth = ow.WriteBlob("a.sth".getBytes());
            ObjectId aTxt = ow.WriteBlob("a.txt".getBytes());
            DirCache dc = DirCache.read(db);
            DirCacheBuilder builder = dc.builder();
            var aSthEntry = new DirCacheEntry("a.sth");
            aSthEntry.setFileMode(FileMode.RegularFile);
            aSthEntry.setObjectId(aSth);
            var aTxtEntry = new DirCacheEntry("a.txt");
            aTxtEntry.setFileMode(FileMode.RegularFile);
            aTxtEntry.setObjectId(aTxt);
            builder.add(aSthEntry);
            builder.add(aTxtEntry);
            builder.finish();
            ObjectId treeId = dc.writeTree(ow);


            var tw = new GitSharp.Core.TreeWalk.TreeWalk(db);
            tw.setFilter(PathSuffixFilter.create(".txt"));
            tw.addTree(treeId);

            var paths = new LinkedList<string>();
            while (tw.next())
            {
                paths.AddLast(tw.getPathString());
            }

            var expected = new LinkedList<string>();
            expected.AddLast("a.txt");

            Assert.AreEqual(expected, paths);
        }
开发者ID:dev218,项目名称:GitSharp,代码行数:34,代码来源:PathSuffixFilterTestCase.cs


示例2: testNoSubtree_NoTreeWalk

        public void testNoSubtree_NoTreeWalk()
        {
            DirCache dc = DirCache.read(db);

            string[] paths = { "a.", "a0b" };
            var ents = new DirCacheEntry[paths.Length];

            for (int i = 0; i < paths.Length; i++)
            {
                ents[i] = new DirCacheEntry(paths[i]);
            }

            DirCacheBuilder b = dc.builder();
            for (int i = 0; i < ents.Length; i++)
            {
                b.add(ents[i]);
            }

            b.finish();

            var iter = new DirCacheIterator(dc);
            int pathIdx = 0;
            for (; !iter.eof(); iter.next(1))
            {
                Assert.AreEqual(pathIdx, iter.Pointer);
                Assert.AreSame(ents[pathIdx], iter.getDirCacheEntry());
                pathIdx++;
            }

            Assert.AreEqual(paths.Length, pathIdx);
        }
开发者ID:stschake,项目名称:GitSharp,代码行数:31,代码来源:DirCacheIteratorTest.cs


示例3: testLongPath

        private void testLongPath(int len)
        {
            string longPath = makeLongPath(len);
            string shortPath = "~~~ shorter-path";

            DirCacheEntry longEnt = new DirCacheEntry(longPath);
            DirCacheEntry shortEnt = new DirCacheEntry(shortPath);

            longEnt.setFileMode(FileMode.RegularFile);
            shortEnt.setFileMode(FileMode.RegularFile);

            Assert.AreEqual(longPath, longEnt.getPathString());
            Assert.AreEqual(shortPath, shortEnt.getPathString());

            DirCache dc1 = DirCache.Lock(db);
            DirCacheBuilder b = dc1.builder();
            b.add(longEnt);
            b.add(shortEnt);
            Assert.IsTrue(b.commit());
            Assert.AreEqual(2, dc1.getEntryCount());
            Assert.AreSame(longEnt, dc1.getEntry(0));
            Assert.AreSame(shortEnt, dc1.getEntry(1));

            DirCache dc2 = DirCache.read(db);
            Assert.AreEqual(2, dc2.getEntryCount());
            Assert.AreNotSame(longEnt, dc2.getEntry(0));
            Assert.AreEqual(longPath, dc2.getEntry(0).getPathString());
            Assert.AreNotSame(shortEnt, dc2.getEntry(1));
            Assert.AreEqual(shortPath, dc2.getEntry(1).getPathString());
        }
开发者ID:dev218,项目名称:GitSharp,代码行数:30,代码来源:DirCacheLargePathTest.cs


示例4: testEntriesWithin

        public void testEntriesWithin()
        {
            DirCache dc = DirCache.read(db);

            string[] paths = { "a.", "a/b", "a/c", "a/d", "a0b" };
            DirCacheEntry[] ents = new DirCacheEntry[paths.Length];
            for (int i = 0; i < paths.Length; i++)
            {
                ents[i] = new DirCacheEntry(paths[i]);
                ents[i].setFileMode(FileMode.RegularFile);
            }

            int aFirst = 1;
            int aLast = 3;

            DirCacheBuilder b = dc.builder();
            for (int i = 0; i < ents.Length; i++)
            {
                b.add(ents[i]);
            }
            b.finish();

            Assert.AreEqual(paths.Length, dc.getEntryCount());
            for (int i = 0; i < ents.Length; i++)
            {
                Assert.AreSame(ents[i], dc.getEntry(i));
            }

            DirCacheEntry[] aContents = dc.getEntriesWithin("a");
            Assert.IsNotNull(aContents);
            Assert.AreEqual(aLast - aFirst + 1, aContents.Length);
            for (int i = aFirst, j = 0; i <= aLast; i++, j++)
            {
                Assert.AreSame(ents[i], aContents[j]);
            }

            aContents = dc.getEntriesWithin("a/");
            Assert.IsNotNull(aContents);
            Assert.AreEqual(aLast - aFirst + 1, aContents.Length);
            for (int i = aFirst, j = 0; i <= aLast; i++, j++)
            {
                Assert.AreSame(ents[i], aContents[j]);
            }

            Assert.IsNotNull(dc.getEntriesWithin("a."));
            Assert.AreEqual(0, dc.getEntriesWithin("a.").Length);

            Assert.IsNotNull(dc.getEntriesWithin("a0b"));
            Assert.AreEqual(0, dc.getEntriesWithin("a0b.").Length);

            Assert.IsNotNull(dc.getEntriesWithin("zoo"));
            Assert.AreEqual(0, dc.getEntriesWithin("zoo.").Length);
        }
开发者ID:spraints,项目名称:GitSharp,代码行数:53,代码来源:DirCacheFindTest.cs


示例5: testCreate_ByStringPathAndStage

        public void testCreate_ByStringPathAndStage()
        {
            DirCacheEntry e;

            e = new DirCacheEntry("a", 0);
            Assert.AreEqual("a", e.getPathString());
            Assert.AreEqual(0, e.getStage());

            e = new DirCacheEntry("a/b", 1);
            Assert.AreEqual("a/b", e.getPathString());
            Assert.AreEqual(1, e.getStage());

            e = new DirCacheEntry("a/c", 2);
            Assert.AreEqual("a/c", e.getPathString());
            Assert.AreEqual(2, e.getStage());

            e = new DirCacheEntry("a/d", 3);
            Assert.AreEqual("a/d", e.getPathString());
            Assert.AreEqual(3, e.getStage());

            try
            {
                new DirCacheEntry("/a", 1);
                Assert.Fail("Incorrectly created DirCacheEntry");
            }
            catch (ArgumentException err)
            {
                Assert.AreEqual("Invalid path: /a", err.Message);
            }

            try
            {
                new DirCacheEntry("a", -11);
                Assert.Fail("Incorrectly created DirCacheEntry");
            }
            catch (ArgumentException err)
            {
                Assert.AreEqual("Invalid stage -11 for path a", err.Message);
            }

            try
            {
                new DirCacheEntry("a", 4);
                Assert.Fail("Incorrectly created DirCacheEntry");
            }
            catch (ArgumentException err)
            {
                Assert.AreEqual("Invalid stage 4 for path a", err.Message);
            }
        }
开发者ID:spraints,项目名称:GitSharp,代码行数:50,代码来源:DirCacheEntryTest.cs


示例6: testPathFilterGroup_DoesNotSkipTail

		public void testPathFilterGroup_DoesNotSkipTail()
		{
			DirCache dc = DirCache.read(db);

			var mode = FileMode.RegularFile;
			string[] paths = { "a.", "a/b", "a/c", "a/d", "a0b" };
			var ents = new DirCacheEntry[paths.Length];
			for (int i = 0; i < paths.Length; i++)
			{
				ents[i] = new DirCacheEntry(paths[i]);
				ents[i].setFileMode(mode);
			}

			DirCacheBuilder builder = dc.builder();
			for (int i = 0; i < ents.Length; i++)
			{
				builder.add(ents[i]);
			}
			builder.finish();

			const int expIdx = 2;
			DirCacheBuilder b = dc.builder();
			var tw = new GitSharp.Core.TreeWalk.TreeWalk(db);
			tw.reset();
			tw.addTree(new DirCacheBuildIterator(b));
			tw.Recursive = true;
			tw.setFilter(PathFilterGroup.createFromStrings(new[] { paths[expIdx] }));

			Assert.IsTrue(tw.next(), "found " + paths[expIdx]);
			var c = tw.getTree<DirCacheIterator>(0, typeof(DirCacheIterator));
			Assert.IsNotNull(c);
			Assert.AreEqual(expIdx, c.Pointer);
			Assert.AreSame(ents[expIdx], c.getDirCacheEntry());
			Assert.AreEqual(paths[expIdx], tw.getPathString());
			Assert.AreEqual(mode.Bits, tw.getRawMode(0));
			Assert.AreSame(mode, tw.getFileMode(0));
			b.add(c.getDirCacheEntry());

			Assert.IsFalse(tw.next(), "no more entries");

			b.finish();
			Assert.AreEqual(ents.Length, dc.getEntryCount());
			for (int i = 0; i < ents.Length; i++)
			{
				Assert.AreSame(ents[i], dc.getEntry(i));
			}
		}
开发者ID:dev218,项目名称:GitSharp,代码行数:47,代码来源:DirCacheBuilderIteratorTest.cs


示例7: testBuildRejectsUnsetFileMode

        public void testBuildRejectsUnsetFileMode()
        {
            DirCache dc = DirCache.newInCore();
            DirCacheBuilder b = dc.builder();
            Assert.IsNotNull(b);

            DirCacheEntry e = new DirCacheEntry("a");
            Assert.AreEqual(0, e.getRawMode());
            try
            {
                b.add(e);
            }
            catch (ArgumentException err)
            {
                Assert.AreEqual("FileMode not set for path a", err.Message);
            }
        }
开发者ID:dev218,项目名称:GitSharp,代码行数:17,代码来源:DirCacheBuilderTest.cs


示例8: testAdd_InGitSortOrder

        public void testAdd_InGitSortOrder()
        {
            DirCache dc = DirCache.read(db);

            string[] paths = { "a.", "a.b", "a/b", "a0b" };
            DirCacheEntry[] ents = new DirCacheEntry[paths.Length];
            for (int i = 0; i < paths.Length; i++)
                ents[i] = new DirCacheEntry(paths[i]);

            DirCacheBuilder b = dc.builder();
            for (int i = 0; i < ents.Length; i++)
                b.add(ents[i]);
            b.finish();

            Assert.AreEqual(paths.Length, dc.getEntryCount());
            for (int i = 0; i < paths.Length; i++)
            {
                Assert.AreSame(ents[i], dc.getEntry(i));
                Assert.AreEqual(paths[i], dc.getEntry(i).getPathString());
                Assert.AreEqual(i, dc.findEntry(paths[i]));
                Assert.AreSame(ents[i], dc.getEntry(paths[i]));
            }
        }
开发者ID:jagregory,项目名称:GitSharp,代码行数:23,代码来源:DirCacheBuilderTest.cs


示例9: testBuildThenClear

        public void testBuildThenClear()
        {
            DirCache dc = DirCache.read(db);

            string[] paths = { "a.", "a.b", "a/b", "a0b" };

            var ents = new DirCacheEntry[paths.Length];
            for (int i = 0; i < paths.Length; i++)
            {
                ents[i] = new DirCacheEntry(paths[i]);
            }

            DirCacheBuilder b = dc.builder();
            for (int i = 0; i < ents.Length; i++)
            {
                b.add(ents[i]);
            }

            b.finish();

            Assert.AreEqual(paths.Length, dc.getEntryCount());
            dc.clear();
            Assert.AreEqual(0, dc.getEntryCount());
        }
开发者ID:stschake,项目名称:GitSharp,代码行数:24,代码来源:DirCacheBasicTest.cs


示例10: Compare

		public static int Compare(DirCacheEntry a, DirCacheEntry b)
		{
			return Compare(a.Path, a.Path.Length, b);
		}
开发者ID:stschake,项目名称:GitSharp,代码行数:4,代码来源:DirCache.cs


示例11: ReadFrom

		private void ReadFrom(Stream inStream)
		{
			var @in = new StreamReader(inStream);
			MessageDigest md = Constants.newMessageDigest();

			// Read the index header and verify we understand it.
			//
			var hdr = new byte[20];
			IO.ReadFully(inStream, hdr, 0, 12);
			md.Update(hdr, 0, 12);
			if (!IsDIRC(hdr))
			{
				throw new CorruptObjectException("Not a DIRC file.");
			}

			int ver = NB.DecodeInt32(hdr, 4);
			if (ver != 2)
			{
				throw new CorruptObjectException("Unknown DIRC version " + ver);
			}

			_entryCnt = NB.DecodeInt32(hdr, 8);
			if (_entryCnt < 0)
			{
				throw new CorruptObjectException("DIRC has too many entries.");
			}

			// Load the individual file entries.
			//
			var infos = new byte[InfoLen * _entryCnt];
			_sortedEntries = new DirCacheEntry[_entryCnt];
			for (int i = 0; i < _entryCnt; i++)
			{
				_sortedEntries[i] = new DirCacheEntry(infos, i * InfoLen, inStream, md);
			}
			_lastModified = _liveFile.LastWriteTime;

			// After the file entries are index extensions, and then a footer.
			//
			while (true)
			{
				var pos = inStream.Position;
				IO.ReadFully(inStream, hdr, 0, 20);

				int nextByte = @in.Read();
				if (nextByte < 0 || inStream.Position == inStream.Length)
				{
					// No extensions present; the file ended where we expected.
					//
					break;
				}
				inStream.Seek(pos, SeekOrigin.Begin);

				switch (NB.DecodeInt32(hdr, 0))
				{
					case ExtTree:
						var raw = new byte[NB.DecodeInt32(hdr, 4)];
						md.Update(hdr, 0, 8);
						IO.skipFully(inStream, 8);
						IO.ReadFully(inStream, raw, 0, raw.Length);
						md.Update(raw, 0, raw.Length);
						_cacheTree = new DirCacheTree(raw, new MutableInteger(), null);
						break;

					default:
						if (hdr[0] >= (byte)'A' && hdr[0] <= (byte)'Z')
						{
							// The extension is optional and is here only as
							// a performance optimization. Since we do not
							// understand it, we can safely skip past it.
							//
							IO.skipFully(inStream, NB.decodeUInt32(hdr, 4));
						}
						else
						{
							// The extension is not an optimization and is
							// _required_ to understand this index format.
							// Since we did not trap it above we must abort.
							//
							throw new CorruptObjectException("DIRC extension '"
									+ Constants.CHARSET.GetString(hdr.Take(4).ToArray())
									+ "' not supported by this version.");
						}

						break;
				}
			}

			byte[] exp = md.Digest();
			if (!exp.SequenceEqual(hdr))
			{
				throw new CorruptObjectException("DIRC checksum mismatch");
			}
		}
开发者ID:stschake,项目名称:GitSharp,代码行数:94,代码来源:DirCache.cs


示例12: replace

		public void replace(DirCacheEntry[] e, int cnt)
		{
			_sortedEntries = e;
			_entryCnt = cnt;
			_cacheTree = null;
		}
开发者ID:stschake,项目名称:GitSharp,代码行数:6,代码来源:DirCache.cs


示例13: testTwoLevelSubtree_FilterPath

        public void testTwoLevelSubtree_FilterPath()
        {
            DirCache dc = DirCache.read(db);

            FileMode mode = FileMode.RegularFile;
            string[] paths = { "a.", "a/b", "a/c/e", "a/c/f", "a/d", "a0b" };
            var ents = new DirCacheEntry[paths.Length];
            for (int i = 0; i < paths.Length; i++)
            {
                ents[i] = new DirCacheEntry(paths[i]);
                ents[i].setFileMode(mode);
            }

            DirCacheBuilder b = dc.builder();
            for (int i = 0; i < ents.Length; i++)
            {
                b.add(ents[i]);
            }
            b.finish();

            var tw = new GitSharp.Core.TreeWalk.TreeWalk(db);
            for (int victimIdx = 0; victimIdx < paths.Length; victimIdx++)
            {
                tw.reset();
                tw.addTree(new DirCacheIterator(dc));
                tw.setFilter(PathFilterGroup.createFromStrings(new[] { paths[victimIdx] }));
                tw.Recursive = tw.getFilter().shouldBeRecursive();
                Assert.IsTrue(tw.next());
                var c = tw.getTree<DirCacheIterator>(0, typeof(DirCacheIterator));
                Assert.IsNotNull(c);
                Assert.AreEqual(victimIdx, c.Pointer);
                Assert.AreSame(ents[victimIdx], c.getDirCacheEntry());
                Assert.AreEqual(paths[victimIdx], tw.getPathString());
                Assert.AreEqual(mode.Bits, tw.getRawMode(0));
                Assert.AreSame(mode, tw.getFileMode(0));
                Assert.IsFalse(tw.next());
            }
        }
开发者ID:stschake,项目名称:GitSharp,代码行数:38,代码来源:DirCacheIteratorTest.cs


示例14: testFindSingleFile

        public void testFindSingleFile()
        {
            string path = "a-File-path";
            DirCache dc = DirCache.read(db);
            DirCacheBuilder b = dc.builder();
            Assert.IsNotNull(b);

            DirCacheEntry entOrig = new DirCacheEntry(path);
            Assert.AreNotSame(path, entOrig.getPathString());
            Assert.AreEqual(path, entOrig.getPathString());
            b.add(entOrig);
            b.finish();

            Assert.AreEqual(1, dc.getEntryCount());
            Assert.AreSame(entOrig, dc.getEntry(0));
            Assert.AreEqual(0, dc.findEntry(path));

            Assert.AreEqual(-1, dc.findEntry("@@-before"));
            Assert.AreEqual(0, real(dc.findEntry("@@-before")));

            Assert.AreEqual(-2, dc.findEntry("a-zoo"));
            Assert.AreEqual(1, real(dc.findEntry("a-zoo")));

            Assert.AreSame(entOrig, dc.getEntry(path));
        }
开发者ID:jagregory,项目名称:GitSharp,代码行数:25,代码来源:DirCacheBuilderTest.cs


示例15: testNoSubtree_WithTreeWalk

        public void testNoSubtree_WithTreeWalk()
        {
            DirCache dc = DirCache.read(db);

            string[] paths = { "a.", "a0b" };
            FileMode[] modes = { FileMode.ExecutableFile, FileMode.GitLink };
            var ents = new DirCacheEntry[paths.Length];
            for (int i = 0; i < paths.Length; i++)
            {
                ents[i] = new DirCacheEntry(paths[i]);
                ents[i].setFileMode(modes[i]);
            }

            DirCacheBuilder b = dc.builder();
            for (int i = 0; i < ents.Length; i++)
            {
                b.add(ents[i]);
            }
            b.finish();

            var iter = new DirCacheIterator(dc);
            var tw = new GitSharp.Core.TreeWalk.TreeWalk(db);
            tw.reset();
            tw.addTree(iter);
            int pathIdx = 0;
            while (tw.next())
            {
                Assert.AreSame(iter, tw.getTree<DirCacheIterator>(0, typeof(DirCacheIterator)));
                Assert.AreEqual(pathIdx, iter.Pointer);
                Assert.AreSame(ents[pathIdx], iter.getDirCacheEntry());
                Assert.AreEqual(paths[pathIdx], tw.getPathString());
                Assert.AreEqual(modes[pathIdx].Bits, tw.getRawMode(0));
                Assert.AreSame(modes[pathIdx], tw.getFileMode(0));
                pathIdx++;
            }
            Assert.AreEqual(paths.Length, pathIdx);
        }
开发者ID:stschake,项目名称:GitSharp,代码行数:37,代码来源:DirCacheIteratorTest.cs


示例16: Apply

 /// <summary>
 /// Apply the update to a single cache entry matching the path.
 /// <para />
 /// After apply is invoked the entry is added to the output table, and
 /// will be included in the new index.
 /// </summary>
 /// <param name="ent">
 /// The entry being processed. All fields are zeroed out if
 /// the path is a new path in the index.
 /// </param>
 public abstract void Apply(DirCacheEntry ent);
开发者ID:stschake,项目名称:GitSharp,代码行数:11,代码来源:DirCacheEditor.cs


示例17: testSetFileMode

        public void testSetFileMode()
        {
            DirCacheEntry e = new DirCacheEntry("a");

            Assert.AreEqual(0, e.getRawMode());

            e.setFileMode(FileMode.RegularFile);
            Assert.AreSame(FileMode.RegularFile, e.getFileMode());
            Assert.AreEqual(FileMode.RegularFile.Bits, e.getRawMode());

            e.setFileMode(FileMode.ExecutableFile);
            Assert.AreSame(FileMode.ExecutableFile, e.getFileMode());
            Assert.AreEqual(FileMode.ExecutableFile.Bits, e.getRawMode());

            e.setFileMode(FileMode.Symlink);
            Assert.AreSame(FileMode.Symlink, e.getFileMode());
            Assert.AreEqual(FileMode.Symlink.Bits, e.getRawMode());

            e.setFileMode(FileMode.GitLink);
            Assert.AreSame(FileMode.GitLink, e.getFileMode());
            Assert.AreEqual(FileMode.GitLink.Bits, e.getRawMode());

            try
            {
                e.setFileMode(FileMode.Missing);
                Assert.Fail("incorrectly accepted FileMode.MISSING");
            }
            catch (ArgumentException err)
            {
                Assert.AreEqual("Invalid mode 0 for path a", err.Message);
            }

            try
            {
                e.setFileMode(FileMode.Tree);
                Assert.Fail("incorrectly accepted FileMode.TREE");
            }
            catch (ArgumentException err)
            {
                Assert.AreEqual("Invalid mode " + FileMode.TYPE_TREE + " for path a", err.Message);
            }
        }
开发者ID:spraints,项目名称:GitSharp,代码行数:42,代码来源:DirCacheEntryTest.cs


示例18: testSingleSubtree_NoRecursion

        public void testSingleSubtree_NoRecursion()
        {
            DirCache dc = DirCache.read(db);

            string[] paths = { "a.", "a/b", "a/c", "a/d", "a0b" };
            var ents = new DirCacheEntry[paths.Length];
            for (int i = 0; i < paths.Length; i++)
            {
                ents[i] = new DirCacheEntry(paths[i]);
                ents[i].setFileMode(FileMode.RegularFile);
            }

            DirCacheBuilder b = dc.builder();
            for (int i = 0; i < ents.Length; i++)
            {
                b.add(ents[i]);
            }
            b.finish();

            string[] expPaths = { "a.", "a", "a0b" };
            FileMode[] expModes = { FileMode.RegularFile, FileMode.Tree, FileMode.RegularFile };
            var expPos = new[] { 0, -1, 4 };

            var iter = new DirCacheIterator(dc);
            var tw = new GitSharp.Core.TreeWalk.TreeWalk(db);
            tw.reset();
            tw.addTree(iter);
            tw.Recursive = false;
            int pathIdx = 0;
            while (tw.next())
            {
                Assert.AreSame(iter, tw.getTree<DirCacheIterator>(0, typeof(DirCacheIterator)));
                Assert.AreEqual(expModes[pathIdx].Bits, tw.getRawMode(0));
                Assert.AreSame(expModes[pathIdx], tw.getFileMode(0));
                Assert.AreEqual(expPaths[pathIdx], tw.getPathString());

                if (expPos[pathIdx] >= 0)
                {
                    Assert.AreEqual(expPos[pathIdx], iter.Pointer);
                    Assert.AreSame(ents[expPos[pathIdx]], iter.getDirCacheEntry());
                }
                else
                {
                    Assert.AreSame(FileMode.Tree, tw.getFileMode(0));
                }

                pathIdx++;
            }
            Assert.AreEqual(expPaths.Length, pathIdx);
        }
开发者ID:stschake,项目名称:GitSharp,代码行数:50,代码来源:DirCacheIteratorTest.cs


示例19: MakeEntry

 private DirCacheEntry MakeEntry(string path, FileMode mode, String content)
 {
     var ent = new DirCacheEntry(path);
     ent.setFileMode(mode);
     byte[] contentBytes = Constants.encode(content);
     ent.setObjectId(new ObjectWriter(db).ComputeBlobSha1(contentBytes.Length, new MemoryStream(contentBytes)));
     return ent;
 }
开发者ID:georgeck,项目名称:GitSharp,代码行数:8,代码来源:SimpleMergeTest.cs


示例20: testSingleSubtree

        public void testSingleSubtree()
        {
            DirCache dc = DirCache.read(db);

            string[] paths = { "a.", "a/b", "a/c", "a/d", "a0b" };
            DirCacheEntry[] ents = new DirCacheEntry[paths.Length];
            for (int i = 0; i < paths.Length; i++)
            {
                ents[i] = new DirCacheEntry(paths[i]);
                ents[i].setFileMode(FileMode.RegularFile);
            }
            int aFirst = 1;
            int aLast = 3;

            DirCacheBuilder b = dc.builder();
            for (int i = 0; i < ents.Length; i++)
                b.add(ents[i]);
            b.finish();

            Assert.IsNull(dc.getCacheTree(false));
            DirCacheTree root = dc.getCacheTree(true);
            Assert.IsNotNull(root);
            Assert.AreSame(root, dc.getCacheTree(true));
            Assert.AreEqual(string.Empty, root.getNameString());
            Assert.AreEqual(string.Empty, root.getPathString());
            Assert.AreEqual(1, root.getChildCount());
            Assert.AreEqual(dc.getEntryCount(), root.getEntrySpan());
            Assert.IsFalse(root.isValid());

            DirCacheTree aTree = root.getChild(0);
            Assert.IsNotNull(aTree);
            Assert.AreSame(aTree, root.getChild(0));
            Assert.AreEqual("a", aTree.getNameString());
            Assert.AreEqual("a/", aTree.getPathString());
            Assert.AreEqual(0, aTree.getChildCount());
            Assert.AreEqual(aLast - aFirst + 1, aTree.getEntrySpan());
            Assert.IsFalse(aTree.isValid());
        }
开发者ID:dev218,项目名称:GitSharp,代码行数:38,代码来源:DirCacheTreeTest.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Transport.URIish类代码示例发布时间:2022-05-26
下一篇:
C# Core.Tree类代码示例发布时间: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