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

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Oct 19 16:19:17 BST 2009


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

------------------------------------------------------------
revno: 4631
revision-id: v.ladeuil+lp at free.fr-20091019151917-iq24uo0t89d2ut9g
parent: v.ladeuil+lp at free.fr-20091019150625-g63lnhrvph8zzax1
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: description
timestamp: Mon 2009-10-19 17:19:17 +0200
message:
  Implement --interactive for PathConflict.
  
  * bzrlib/tests/test_conflicts.py:
  (TestResolvePathConflict): Tests for --interactive.
  
  * bzrlib/conflicts.py:
  (PathConflict): Add actions for --interactive.
  (TextConflict): Ensure TextConflict is not solved like a
  PathConflict (this double the FIXME about inheritance or put
  weight behind the idea that we should define a ConflictSolver
  hierarchy independent from the Conflict hierarchy...).
-------------- next part --------------
=== modified file 'bzrlib/conflicts.py'
--- a/bzrlib/conflicts.py	2009-10-19 15:06:25 +0000
+++ b/bzrlib/conflicts.py	2009-10-19 15:19:17 +0000
@@ -414,6 +414,13 @@
             s.add('conflict_path', self.conflict_path)
         return s
 
+    def keep_mine(self, tree):
+        tree.rename_one(self.conflict_path, self.path)
+
+    def take_theirs(self, tree):
+        # just acccept bzr proposal
+        pass
+
 
 class ContentsConflict(PathConflict):
     """The files are of different types, or not present"""
@@ -442,6 +449,12 @@
 
     format = 'Text conflict in %(path)s'
 
+    def keep_mine(self, tree):
+        raise NotImplementedError(self.keep_mine)
+
+    def take_theirs(self, tree):
+        raise NotImplementedError(self.take_theirs)
+
 
 class HandledConflict(Conflict):
     """A path problem that has been provisionally resolved.

=== modified file 'bzrlib/tests/test_conflicts.py'
--- a/bzrlib/tests/test_conflicts.py	2009-10-19 15:06:25 +0000
+++ b/bzrlib/tests/test_conflicts.py	2009-10-19 15:19:17 +0000
@@ -507,6 +507,20 @@
 $ bzr commit --strict -m 'No more conflicts nor unknown files'
 """)
 
+    def test_resolve_keeping_mine(self):
+        self.run_script("""
+$ bzr resolve --interactive file-in-branch
+<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-in-branch
+<take_theirs
+$ bzr commit --strict -m 'No more conflicts nor unknown files'
+""")
+
 
 class TestResolveParentLoop(TestResolveConflicts):
 



More information about the bazaar-commits mailing list