Rev 4626: Implement --interactive for ContentsConflict. in file:///home/vila/src/bzr/experimental/conflict-manager/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Oct 19 09:51:56 BST 2009


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

------------------------------------------------------------
revno: 4626
revision-id: v.ladeuil+lp at free.fr-20091019085156-3pq8i5e51y6c7uui
parent: v.ladeuil+lp at free.fr-20091017095824-51hxi0o8agj3w5de
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: description
timestamp: Mon 2009-10-19 10:51:56 +0200
message:
  Implement --interactive for ContentsConflict.
  
  * bzrlib/tests/test_conflicts.py:
  (TestResolveContentConflicts): Tests for --interactive.
  
  * bzrlib/conflicts.py:
  (_resolve_interactive): Clean up the files creted to help
  resolving the conflict if any.
  (ContentsConflict): Add actions for --interactive.
-------------- next part --------------
=== modified file 'bzrlib/conflicts.py'
--- a/bzrlib/conflicts.py	2009-10-17 09:58:24 +0000
+++ b/bzrlib/conflicts.py	2009-10-19 08:51:56 +0000
@@ -108,7 +108,7 @@
             if file_list is None or len(file_list) != 1:
                 raise errors.BzrCommandError(
                     '--interactive requires a single FILE parameter')
-            _resolve_interactive( tree, file_list[0])
+            _resolve_interactive(tree, file_list[0])
         else:
             tree, file_list = builtins.tree_files(file_list)
             if file_list is None:
@@ -180,6 +180,8 @@
         if action is None:
             raise NotImplementedError(action_name)
         action(tree)
+        # FIXME: We need an API to use that on a single conflict
+        ConflictList([c]).remove_files(tree)
         tree.set_conflicts(remaining)
     finally:
         tree.unlock()
@@ -422,6 +424,12 @@
 
     format = 'Contents conflict in %(path)s'
 
+    def keep_mine(self, tree):
+        tree.remove([self.path + '.OTHER'], force=True, keep_files=False)
+
+    def take_theirs(self, tree):
+        tree.remove([self.path], force=True, keep_files=False)
+
 
 class TextConflict(PathConflict):
     """The merge algorithm could not resolve all differences encountered."""

=== modified file 'bzrlib/tests/test_conflicts.py'
--- a/bzrlib/tests/test_conflicts.py	2009-10-17 09:58:24 +0000
+++ b/bzrlib/tests/test_conflicts.py	2009-10-19 08:51:56 +0000
@@ -216,20 +216,34 @@
 2>1 conflicts encountered.
 """
 
-    def test_keep_this(self):
+    def test_keep_mine(self):
         self.run_script("""
 $ bzr rm file.OTHER --force # a simple rm file.OTHER is valid too
 $ bzr resolve file
 $ bzr commit --strict -m 'No more conflicts nor unknown files'
 """)
 
-    def test_keep_other(self):
+    def test_take_theirs(self):
         self.run_script("""
 $ bzr mv file.OTHER file
 $ bzr resolve file
 $ bzr commit --strict -m 'No more conflicts nor unknown files'
 """)
 
+    def test_resolve_keeping_mine(self):
+        self.run_script("""
+$ bzr resolve --interactive file
+<keep_mine
+$ bzr commit --strict -m 'No more conflicts nor unknown files'
+""")
+
+    def test_resolve_taking_theirs(self):
+        self.run_script("""
+$ bzr resolve --interactive file
+<take_theirs
+$ bzr commit --strict -m 'No more conflicts nor unknown files'
+""")
+
 
 class TestResolveDuplicatePaths(TestResolveConflicts):
 



More information about the bazaar-commits mailing list