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

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Oct 19 18:04:52 BST 2009


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

------------------------------------------------------------
revno: 4632
revision-id: v.ladeuil+lp at free.fr-20091019170452-xtm6l6411trwca4o
parent: v.ladeuil+lp at free.fr-20091019151917-iq24uo0t89d2ut9g
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: description
timestamp: Mon 2009-10-19 19:04:52 +0200
message:
  Implement --interactive for ParentLoop.
  
  * bzrlib/tests/test_conflicts.py:
  (TestResolveParentLoop): Tests for --interactive.
  
  * bzrlib/conflicts.py:
  (ParentLoop): Add actions for --interactive. Presumably the
  conflcit itself should have more info about the involved paths.
-------------- next part --------------
=== modified file 'bzrlib/conflicts.py'
--- a/bzrlib/conflicts.py	2009-10-19 15:19:17 +0000
+++ b/bzrlib/conflicts.py	2009-10-19 17:04:52 +0000
@@ -544,6 +544,19 @@
 
     format = 'Conflict moving %(conflict_path)s into %(path)s.  %(action)s.'
 
+    def keep_mine(self, tree):
+        # just acccept bzr proposal
+        pass
+
+    def take_theirs(self, tree):
+        # FIXME: We should have to manipulate so many paths here (and there is
+        # probably a bug or two...)
+        conflict_base_path = osutils.basename(self.conflict_path)
+        base_path = osutils.basename(self.path)
+        tree.rename_one(self.conflict_path, conflict_base_path)
+        tree.rename_one(self.path,
+                        osutils.joinpath([conflict_base_path, base_path]))
+
 
 class UnversionedParent(HandledConflict):
     """An attempt to version a file whose parent directory is not versioned.

=== modified file 'bzrlib/tests/test_conflicts.py'
--- a/bzrlib/tests/test_conflicts.py	2009-10-19 15:19:17 +0000
+++ b/bzrlib/tests/test_conflicts.py	2009-10-19 17:04:52 +0000
@@ -543,13 +543,13 @@
 2>1 conflicts encountered.
 """
 
-    def test_keep_target(self):
+    def test_keep_mine(self):
         self.run_script("""
 $ bzr resolve dir2
 $ bzr commit --strict -m 'No more conflicts nor unknown files'
 """)
 
-    def test_keep_source(self):
+    def test_take_theirs(self):
         self.run_script("""
 $ bzr mv dir2/dir1 dir1
 $ bzr mv dir2 dir1
@@ -557,6 +557,20 @@
 $ bzr commit --strict -m 'No more conflicts nor unknown files'
 """)
 
+    def test_resolve_keeping_mine(self):
+        self.run_script("""
+$ bzr resolve --interactive dir2
+<keep_mine
+$ bzr commit --strict -m 'No more conflicts nor unknown files'
+""")
+
+    def test_resolve_taking_theirs(self):
+        self.run_script("""
+$ bzr resolve --interactive dir2
+<take_theirs
+$ bzr commit --strict -m 'No more conflicts nor unknown files'
+""")
+
 
 class TestResolveNonDirectoryParent(TestResolveConflicts):
 



More information about the bazaar-commits mailing list