コード例 #1
0
        public virtual void TestDF_NoGap()
        {
            DirCache tree0 = db.ReadDirCache();
            DirCache tree1 = db.ReadDirCache();
            {
                DirCacheBuilder b0 = tree0.Builder();
                DirCacheBuilder b1 = tree1.Builder();
                b0.Add(CreateEntry("a", REGULAR_FILE));
                b0.Add(CreateEntry("a.b", EXECUTABLE_FILE));
                b1.Add(CreateEntry("a/b", REGULAR_FILE));
                b0.Add(CreateEntry("a0b", SYMLINK));
                b0.Finish();
                b1.Finish();
                NUnit.Framework.Assert.AreEqual(3, tree0.GetEntryCount());
                NUnit.Framework.Assert.AreEqual(1, tree1.GetEntryCount());
            }
            NameConflictTreeWalk tw = new NameConflictTreeWalk(db);

            tw.AddTree(new DirCacheIterator(tree0));
            tw.AddTree(new DirCacheIterator(tree1));
            AssertModes("a", REGULAR_FILE, TREE, tw);
            NUnit.Framework.Assert.IsTrue(tw.IsDirectoryFileConflict());
            NUnit.Framework.Assert.IsTrue(tw.IsSubtree);
            tw.EnterSubtree();
            AssertModes("a/b", MISSING, REGULAR_FILE, tw);
            NUnit.Framework.Assert.IsTrue(tw.IsDirectoryFileConflict());
            AssertModes("a.b", EXECUTABLE_FILE, MISSING, tw);
            NUnit.Framework.Assert.IsFalse(tw.IsDirectoryFileConflict());
            AssertModes("a0b", SYMLINK, MISSING, tw);
            NUnit.Framework.Assert.IsFalse(tw.IsDirectoryFileConflict());
        }
コード例 #2
0
        public virtual void TestDF_DetectConflict()
        {
            DirCache tree0 = db.ReadDirCache();
            DirCache tree1 = db.ReadDirCache();
            {
                DirCacheBuilder b0 = tree0.Builder();
                DirCacheBuilder b1 = tree1.Builder();
                b0.Add(MakeEntry("0", REGULAR_FILE));
                b0.Add(MakeEntry("a", REGULAR_FILE));
                b1.Add(MakeEntry("0", REGULAR_FILE));
                b1.Add(MakeEntry("a.b", REGULAR_FILE));
                b1.Add(MakeEntry("a/b", REGULAR_FILE));
                b1.Add(MakeEntry("a/c/e", REGULAR_FILE));
                b0.Finish();
                b1.Finish();
                NUnit.Framework.Assert.AreEqual(2, tree0.GetEntryCount());
                NUnit.Framework.Assert.AreEqual(4, tree1.GetEntryCount());
            }
            NameConflictTreeWalk tw = new NameConflictTreeWalk(db);

            tw.AddTree(new DirCacheIterator(tree0));
            tw.AddTree(new DirCacheIterator(tree1));
            AssertModes("0", REGULAR_FILE, REGULAR_FILE, tw);
            NUnit.Framework.Assert.IsFalse(tw.IsDirectoryFileConflict());
            AssertModes("a", REGULAR_FILE, TREE, tw);
            NUnit.Framework.Assert.IsTrue(tw.IsSubtree);
            NUnit.Framework.Assert.IsTrue(tw.IsDirectoryFileConflict());
            tw.EnterSubtree();
            AssertModes("a/b", MISSING, REGULAR_FILE, tw);
            NUnit.Framework.Assert.IsTrue(tw.IsDirectoryFileConflict());
            AssertModes("a/c", MISSING, TREE, tw);
            NUnit.Framework.Assert.IsTrue(tw.IsDirectoryFileConflict());
            tw.EnterSubtree();
            AssertModes("a/c/e", MISSING, REGULAR_FILE, tw);
            NUnit.Framework.Assert.IsTrue(tw.IsDirectoryFileConflict());
            AssertModes("a.b", MISSING, REGULAR_FILE, tw);
            NUnit.Framework.Assert.IsFalse(tw.IsDirectoryFileConflict());
        }
コード例 #3
0
		public virtual void TestDF_NoGap()
		{
			DirCache tree0 = db.ReadDirCache();
			DirCache tree1 = db.ReadDirCache();
			{
				DirCacheBuilder b0 = tree0.Builder();
				DirCacheBuilder b1 = tree1.Builder();
				b0.Add(MakeEntry("a", REGULAR_FILE));
				b0.Add(MakeEntry("a.b", EXECUTABLE_FILE));
				b1.Add(MakeEntry("a/b", REGULAR_FILE));
				b0.Add(MakeEntry("a0b", SYMLINK));
				b0.Finish();
				b1.Finish();
				NUnit.Framework.Assert.AreEqual(3, tree0.GetEntryCount());
				NUnit.Framework.Assert.AreEqual(1, tree1.GetEntryCount());
			}
			NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
			tw.AddTree(new DirCacheIterator(tree0));
			tw.AddTree(new DirCacheIterator(tree1));
			AssertModes("a", REGULAR_FILE, TREE, tw);
			NUnit.Framework.Assert.IsTrue(tw.IsDirectoryFileConflict());
			NUnit.Framework.Assert.IsTrue(tw.IsSubtree);
			tw.EnterSubtree();
			AssertModes("a/b", MISSING, REGULAR_FILE, tw);
			NUnit.Framework.Assert.IsTrue(tw.IsDirectoryFileConflict());
			AssertModes("a.b", EXECUTABLE_FILE, MISSING, tw);
			NUnit.Framework.Assert.IsFalse(tw.IsDirectoryFileConflict());
			AssertModes("a0b", SYMLINK, MISSING, tw);
			NUnit.Framework.Assert.IsFalse(tw.IsDirectoryFileConflict());
		}
コード例 #4
0
		public virtual void TestDF_DetectConflict()
		{
			DirCache tree0 = db.ReadDirCache();
			DirCache tree1 = db.ReadDirCache();
			{
				DirCacheBuilder b0 = tree0.Builder();
				DirCacheBuilder b1 = tree1.Builder();
				b0.Add(CreateEntry("0", REGULAR_FILE));
				b0.Add(CreateEntry("a", REGULAR_FILE));
				b1.Add(CreateEntry("0", REGULAR_FILE));
				b1.Add(CreateEntry("a.b", REGULAR_FILE));
				b1.Add(CreateEntry("a/b", REGULAR_FILE));
				b1.Add(CreateEntry("a/c/e", REGULAR_FILE));
				b0.Finish();
				b1.Finish();
				NUnit.Framework.Assert.AreEqual(2, tree0.GetEntryCount());
				NUnit.Framework.Assert.AreEqual(4, tree1.GetEntryCount());
			}
			NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
			tw.AddTree(new DirCacheIterator(tree0));
			tw.AddTree(new DirCacheIterator(tree1));
			AssertModes("0", REGULAR_FILE, REGULAR_FILE, tw);
			NUnit.Framework.Assert.IsFalse(tw.IsDirectoryFileConflict());
			AssertModes("a", REGULAR_FILE, TREE, tw);
			NUnit.Framework.Assert.IsTrue(tw.IsSubtree);
			NUnit.Framework.Assert.IsTrue(tw.IsDirectoryFileConflict());
			tw.EnterSubtree();
			AssertModes("a/b", MISSING, REGULAR_FILE, tw);
			NUnit.Framework.Assert.IsTrue(tw.IsDirectoryFileConflict());
			AssertModes("a/c", MISSING, TREE, tw);
			NUnit.Framework.Assert.IsTrue(tw.IsDirectoryFileConflict());
			tw.EnterSubtree();
			AssertModes("a/c/e", MISSING, REGULAR_FILE, tw);
			NUnit.Framework.Assert.IsTrue(tw.IsDirectoryFileConflict());
			AssertModes("a.b", MISSING, REGULAR_FILE, tw);
			NUnit.Framework.Assert.IsFalse(tw.IsDirectoryFileConflict());
		}