Rev 4638: Merge more-auto-resolvable-conflicts into next in file:///home/vila/src/bzr/experimental/conflict-manager/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Nov 15 17:04:35 GMT 2010


At file:///home/vila/src/bzr/experimental/conflict-manager/

------------------------------------------------------------
revno: 4638 [merge]
revision-id: v.ladeuil+lp at free.fr-20101115170435-qqqz52e6zsf0be63
parent: v.ladeuil+lp at free.fr-20101113130136-x2h3gchgmwnje4m7
parent: v.ladeuil+lp at free.fr-20101115170434-0km9rbieu21rxzne
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: next
timestamp: Mon 2010-11-15 18:04:35 +0100
message:
  Merge more-auto-resolvable-conflicts into next
modified:
  bzrlib/tests/test_conflicts.py test_conflicts.py-20051006031059-e2dad9bbeaa5891f
-------------- next part --------------
=== modified file 'bzrlib/tests/test_conflicts.py'
--- a/bzrlib/tests/test_conflicts.py	2010-11-12 09:34:20 +0000
+++ b/bzrlib/tests/test_conflicts.py	2010-11-15 17:04:34 +0000
@@ -631,7 +631,59 @@
     _assert_conflict = assertDuplicateEntry
 
 
-class TestResolveUnversionedParent(TestResolveConflicts):
+class TestResolveUnversionedParent(TestParametrizedResolveConflicts):
+
+    # FIXME: While this *creates* UnversionedParent conflicts, this really only
+    # tests MissingParent resolution :-/
+    scenarios = mirror_scenarios(
+        [
+            # File modified/deleted
+            (dict(_base_actions='create_dir',
+                  _path='dir_or_file', _file_id='dir-id'),
+             ('dir_deleted',
+              dict(actions='delete_dir', check='dir_doesnt_exist')),
+             ('file_added',
+              dict(actions='add_file', check='file_has_content')),),
+            ])
+
+    def do_create_dir(self):
+        return [('add', ('dir', 'dir-id', 'directory', ''))]
+
+    def do_delete_dir(self):
+        return [('unversion', 'dir-id')]
+
+    def check_dir_doesnt_exist(self):
+        self.failIfExists('branch/dir')
+
+    def do_add_file(self):
+        return [('add', ('dir/file', 'file-id', 'file', 'trunk content\n'))]
+
+    def check_file_has_content(self):
+        self.assertFileEqual('trunk content\n', 'branch/dir/file')
+
+    def _get_resolve_path_arg(self, wt, action):
+        return 'dir'
+
+    def assertConflict(self, wt):
+        confs = wt.conflicts()
+        # We've got 2 conflicts here. This is bad for us as it means more code
+        # (and more complexity). This is bad for the user as it makes the
+        # conflict harder to understand and deal with.
+        self.assertLength(2, confs)
+        c = confs[0]
+        self.assertIsInstance(c, (conflicts.MissingParent,
+                                  conflicts.DeletingParent))
+        self.assertEqual('dir-id', c.file_id)
+        self.assertEqual('dir', c.path)
+        # May be we should merge the UnversionParent one into the associated
+        # Missing/DeletingParent when they apply to the same dir ?
+        c = confs[1]
+        self.assertIsInstance(c, conflicts.UnversionedParent)
+        self.assertEqual('dir-id', c.file_id)
+        self.assertEqual('dir', c.path)
+
+
+class OldTestResolveUnversionedParent(TestResolveConflicts):
 
     # FIXME: Add the reverse tests: dir deleted in trunk, file added in branch
 
@@ -657,6 +709,9 @@
 2>Conflict adding files to dir.  Created directory.
 2>Conflict because dir is not versioned, but has versioned children.  Versioned directory.
 2>2 conflicts encountered.
+$ bzr conflicts
+Conflict adding files to dir.  Created directory.
+Conflict because dir is not versioned, but has versioned children.  Versioned directory.
 """
 
     def test_take_this(self):
@@ -728,14 +783,16 @@
     def test_resolve_taking_this(self):
         self.run_script("""
 $ bzr resolve --take-this dir
-2>...
+2>deleted dir/file2
+2>deleted dir
+2>2 conflict(s) resolved, 0 remaining
 $ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 """)
 
     def test_resolve_taking_other(self):
         self.run_script("""
 $ bzr resolve --take-other dir
-2>...
+2>2 conflict(s) resolved, 0 remaining
 $ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 """)
 



More information about the bazaar-commits mailing list