Rev 3520: Write a (failing) test for complex ancestry. in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/weave_merge

John Arbash Meinel john at arbash-meinel.com
Thu Jul 10 19:54:32 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/weave_merge

------------------------------------------------------------
revno: 3520
revision-id: john at arbash-meinel.com-20080710185429-w5k3hqv7dfpc9o2b
parent: john at arbash-meinel.com-20080709232113-qvkxigm18om27i39
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: weave_merge
timestamp: Thu 2008-07-10 13:54:29 -0500
message:
  Write a (failing) test for complex ancestry.
modified:
  bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
-------------- next part --------------
=== modified file 'bzrlib/tests/test_merge.py'
--- a/bzrlib/tests/test_merge.py	2008-07-09 23:21:13 +0000
+++ b/bzrlib/tests/test_merge.py	2008-07-10 18:54:29 +0000
@@ -500,6 +500,20 @@
             plan._get_matching_blocks('B', 'C')),
             ([1, 2, 3], [0, 2]))
 
+    def test_plan_merge(self):
+        self.setup_plan_merge()
+        plan = self.plan_merge_vf.plan_merge('B', 'C')
+        self.assertEqual([
+                          ('new-b', 'f\n'),
+                          ('unchanged', 'a\n'),
+                          ('killed-a', 'b\n'),
+                          ('killed-b', 'c\n'),
+                          ('new-b', 'g\n'),
+                          ('new-a', 'e\n'),
+                          ('new-a', 'h\n'),
+                          ('new-a', 'g\n')],
+                         list(plan))
+
     def test_plan_merge_cherrypick(self):
         self.add_version(('root', 'A'), [], 'abc')
         self.add_version(('root', 'B'), [('root', 'A')], 'abcde')
@@ -530,20 +544,6 @@
                           ('new-a', 'c\n')],
                           list(my_plan.plan_merge()))
 
-    def test_plan_merge(self):
-        self.setup_plan_merge()
-        plan = self.plan_merge_vf.plan_merge('B', 'C')
-        self.assertEqual([
-                          ('new-b', 'f\n'),
-                          ('unchanged', 'a\n'),
-                          ('killed-a', 'b\n'),
-                          ('killed-b', 'c\n'),
-                          ('new-b', 'g\n'),
-                          ('new-a', 'e\n'),
-                          ('new-a', 'h\n'),
-                          ('new-a', 'g\n')],
-                         list(plan))
-
     def test_plan_merge_uncommitted_files(self):
         self.setup_plan_merge_uncommitted()
         plan = self.plan_merge_vf.plan_merge('B:', 'C:')
@@ -558,6 +558,54 @@
                           ('new-a', 'g\n')],
                          list(plan))
 
+    def test_plan_merge_criss_cross(self):
+        # This is specificly trying to trigger problems when using limited
+        # ancestry and weaves. The ancestry graph looks like:
+        #       A       Unique LCA
+        #       |\
+        #       B \     Introduces a line 'foo'
+        #      / \ \
+        #     C   D E   C & D both have 'foo', E has different changes
+        #     |\ /| |
+        #     | X | |
+        #     |/ \|/
+        #     F   G      All of C, D, E are merged into F and G, so they are
+        #                all common ancestors.
+        #
+        # The specific issue with weaves:
+        #   B introduced a text ('foo') that is present in both C and D.
+        #   If we do not include B (because it isn't an ancestor of E), then
+        #   the A=>C and A=>D look like both sides independently introduce the
+        #   text ('foo'). If F does not modify the text, it would still appear
+        #   to have deleted on of the versions from C or D. If G then modifies
+        #   'foo', it should appear as superseding the value in F (since it
+        #   came from B), rather than conflict because of the resolution during
+        #   C & D.
+        self.add_version(('root', 'A'), [], 'abcdef')
+        self.add_version(('root', 'B'), [('root', 'A')], 'axcdef')
+        self.add_version(('root', 'C'), [('root', 'B')], 'axcdefg')
+        self.add_version(('root', 'D'), [('root', 'B')], 'haxcdef')
+        self.add_version(('root', 'E'), [('root', 'A')], 'abcdyf')
+        self.add_version(('root', 'F'),
+                         [('root', 'C'), ('root', 'D'), ('root', 'E')],
+                         'haxcdyfg') #Simple combining of all texts
+        self.add_version(('root', 'G'),
+                         [('root', 'C'), ('root', 'D'), ('root', 'E')],
+                         'hazcdyfg') #combining and supersede 'x'
+        plan = self.plan_merge_vf.plan_merge('F', 'G')
+        self.assertEqual([
+                          ('unchanged', 'h\n'),
+                          ('unchanged', 'a\n'),
+                          ('killed-b', 'x\n'),
+                          ('new-b', 'z\n'),
+                          ('unchanged', 'c\n'),
+                          ('unchanged', 'd\n'),
+                          ('killed-base', 'e\n'),
+                          ('unchanged', 'y\n'),
+                          ('unchanged', 'f\n'),
+                          ('unchanged', 'g\n')],
+                         list(plan))
+
     def test_subtract_plans(self):
         old_plan = [
         ('unchanged', 'a\n'),



More information about the bazaar-commits mailing list