public virtual void TestTrivialTwoWay_conflict() { Merger ourMerger = ((ThreeWayMerger)MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.NewMerger (db)); bool merge = ourMerger.Merge(new ObjectId[] { db.Resolve("f"), db.Resolve("g") }); NUnit.Framework.Assert.IsFalse(merge); }
public virtual void TestTheirs() { Merger ourMerger = MergeStrategy.THEIRS.NewMerger(db); bool merge = ourMerger.Merge(new ObjectId[] { db.Resolve("a"), db.Resolve("c") }); NUnit.Framework.Assert.IsTrue(merge); NUnit.Framework.Assert.AreEqual(db.Resolve("c^{tree}"), ourMerger.GetResultTreeId ()); }
public virtual void TestTrivialTwoWay() { Merger ourMerger = ((ThreeWayMerger)MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.NewMerger (db)); bool merge = ourMerger.Merge(new ObjectId[] { db.Resolve("a"), db.Resolve("c") }); NUnit.Framework.Assert.IsTrue(merge); NUnit.Framework.Assert.AreEqual("02ba32d3649e510002c21651936b7077aa75ffa9", ourMerger .GetResultTreeId().Name); }
public virtual void TestTrivialTwoWay_disjointhistories() { Merger ourMerger = ((ThreeWayMerger)MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.NewMerger (db)); bool merge = ourMerger.Merge(new ObjectId[] { db.Resolve("a"), db.Resolve("c~4") } ); NUnit.Framework.Assert.IsTrue(merge); NUnit.Framework.Assert.AreEqual("86265c33b19b2be71bdd7b8cb95823f2743d03a8", ourMerger .GetResultTreeId().Name); }
public virtual void TestTrivialTwoWay_ok() { Merger ourMerger = ((ThreeWayMerger)MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.NewMerger (db)); bool merge = ourMerger.Merge(new ObjectId[] { db.Resolve("a^0^0^0"), db.Resolve("a^0^0^1" ) }); NUnit.Framework.Assert.IsTrue(merge); NUnit.Framework.Assert.AreEqual(db.Resolve("a^0^0^{tree}"), ourMerger.GetResultTreeId ()); }
public virtual void TestTrivialTwoWay_validSubtreeSort() { DirCache treeB = db.ReadDirCache(); DirCache treeO = db.ReadDirCache(); DirCache treeT = db.ReadDirCache(); { DirCacheBuilder b = treeB.Builder(); DirCacheBuilder o = treeO.Builder(); DirCacheBuilder t = treeT.Builder(); b.Add(CreateEntry("libelf-po/a", FileMode.REGULAR_FILE)); b.Add(CreateEntry("libelf/c", FileMode.REGULAR_FILE)); o.Add(CreateEntry("Makefile", FileMode.REGULAR_FILE)); o.Add(CreateEntry("libelf-po/a", FileMode.REGULAR_FILE)); o.Add(CreateEntry("libelf/c", FileMode.REGULAR_FILE)); t.Add(CreateEntry("libelf-po/a", FileMode.REGULAR_FILE)); t.Add(CreateEntry("libelf/c", FileMode.REGULAR_FILE, "blah")); b.Finish(); o.Finish(); t.Finish(); } ObjectInserter ow = db.NewObjectInserter(); ObjectId b_1 = Commit(ow, treeB, new ObjectId[] { }); ObjectId o_1 = Commit(ow, treeO, new ObjectId[] { b_1 }); ObjectId t_1 = Commit(ow, treeT, new ObjectId[] { b_1 }); Merger ourMerger = ((ThreeWayMerger)MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.NewMerger (db)); bool merge = ourMerger.Merge(new ObjectId[] { o_1, t_1 }); NUnit.Framework.Assert.IsTrue(merge); TreeWalk tw = new TreeWalk(db); tw.Recursive = true; tw.Reset(ourMerger.GetResultTreeId()); NUnit.Framework.Assert.IsTrue(tw.Next()); NUnit.Framework.Assert.AreEqual("Makefile", tw.PathString); AssertCorrectId(treeO, tw); NUnit.Framework.Assert.IsTrue(tw.Next()); NUnit.Framework.Assert.AreEqual("libelf-po/a", tw.PathString); AssertCorrectId(treeO, tw); NUnit.Framework.Assert.IsTrue(tw.Next()); NUnit.Framework.Assert.AreEqual("libelf/c", tw.PathString); AssertCorrectId(treeT, tw); NUnit.Framework.Assert.IsFalse(tw.Next()); }