Rev 3549: A few more merge-level behavior tests. in http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/merge_lca_multi

John Arbash Meinel john at arbash-meinel.com
Wed Jul 30 21:49:01 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/merge_lca_multi

------------------------------------------------------------
revno: 3549
revision-id: john at arbash-meinel.com-20080730204837-w9gj1gjbvgusuuzu
parent: john at arbash-meinel.com-20080730203540-73uaw4di6m0yuxzh
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: merge_lca_multi
timestamp: Wed 2008-07-30 15:48:37 -0500
message:
  A few more merge-level behavior tests.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_merge.py'
--- a/bzrlib/tests/test_merge.py	2008-07-30 20:35:40 +0000
+++ b/bzrlib/tests/test_merge.py	2008-07-30 20:48:37 +0000
@@ -1725,6 +1725,52 @@
         self.assertEqual(0, conflicts)
         self.assertTrue(wt.is_executable('foo-id'))
 
+    def test_other_reverted_path_to_base(self):
+        #   A       Path at 'foo'
+        #  / \
+        # B   C     Path at 'bar' in B
+        # |\ /|
+        # | X |
+        # |/ \|
+        # D   E     Path at 'bar'
+        #     |
+        #     F     Path at 'foo'
+        builder = self.get_builder()
+        builder.build_snapshot('A-id', None,
+            [('add', (u'', 'a-root-id', 'directory', None)),
+             ('add', (u'foo', 'foo-id', 'file', 'a\nb\nc\n'))])
+        builder.build_snapshot('C-id', ['A-id'], [])
+        builder.build_snapshot('B-id', ['A-id'],
+            [('rename', ('foo', 'bar'))])
+        builder.build_snapshot('E-id', ['C-id', 'B-id'],
+            [('rename', ('foo', 'bar'))]) # merge the rename
+        builder.build_snapshot('F-id', ['E-id'],
+            [('rename', ('bar', 'foo'))]) # Rename back to BASE
+        builder.build_snapshot('D-id', ['B-id', 'C-id'], [])
+        wt, conflicts = self.do_merge(builder, 'F-id')
+        self.assertEqual(0, conflicts)
+        self.assertEqual('foo', wt.id2path('foo-id'))
+
+    def test_other_reverted_content_to_base(self):
+        builder = self.get_builder()
+        builder.build_snapshot('A-id', None,
+            [('add', (u'', 'a-root-id', 'directory', None)),
+             ('add', (u'foo', 'foo-id', 'file', 'base content\n'))])
+        builder.build_snapshot('C-id', ['A-id'], [])
+        builder.build_snapshot('B-id', ['A-id'],
+            [('modify', ('foo-id', 'B content\n'))])
+        builder.build_snapshot('E-id', ['C-id', 'B-id'],
+            [('modify', ('foo-id', 'B content\n'))]) # merge the content
+        builder.build_snapshot('F-id', ['E-id'],
+            [('modify', ('foo-id', 'base content\n'))]) # Revert back to BASE
+        builder.build_snapshot('D-id', ['B-id', 'C-id'], [])
+        wt, conflicts = self.do_merge(builder, 'F-id')
+        self.assertEqual(0, conflicts)
+        # TODO: We need to use the per-file graph to properly select a BASE
+        #       before this will work.
+        self.expectFailure("Merge3Merger doesn't recognize reverted content",
+            self.assertEqual, 'base content\n', wt.get_file_text('foo-id'))
+
 
     # TODO: cases to test
     #       simple criss-cross LCAS identical, BASE different
@@ -1735,10 +1781,6 @@
     #       x-x file missing in LCA
     #       x-x Reverted back to BASE text
     #       x-x Symlink targets, similar to file contents
-    #       x-x Only executable bit changed, not really possible to test via
-    #           builder api, only TreeTransform supports executable on all
-    #           platforms.
-    #       x-x Handle 'interesting_files' or 'interesting_ids'
 
 class TestLCAMultiWay(tests.TestCase):
 



More information about the bazaar-commits mailing list