Rev 4633: Implement --interactive for NonDirectoryParent, sort of. in file:///home/vila/src/bzr/experimental/conflict-manager/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Tue Oct 20 15:47:13 BST 2009
At file:///home/vila/src/bzr/experimental/conflict-manager/
------------------------------------------------------------
revno: 4633
revision-id: v.ladeuil+lp at free.fr-20091020144712-8kdhonvi42q7aoos
parent: v.ladeuil+lp at free.fr-20091019170452-xtm6l6411trwca4o
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: description
timestamp: Tue 2009-10-20 16:47:12 +0200
message:
Implement --interactive for NonDirectoryParent, sort of.
* bzrlib/tests/test_conflicts.py:
(TestResolveNonDirectoryParent): Tests for --interactive.
* bzrlib/conflicts.py:
(NonDirectoryParent): Add actions for --interactive, noting that
we lack the relevant information :-/
-------------- next part --------------
=== modified file 'bzrlib/conflicts.py'
--- a/bzrlib/conflicts.py 2009-10-19 17:04:52 +0000
+++ b/bzrlib/conflicts.py 2009-10-20 14:47:12 +0000
@@ -612,7 +612,7 @@
class NonDirectoryParent(HandledConflict):
- """An attempt to add files to a directory that is not a director or
+ """An attempt to add files to a directory that is not a directory or
an attempt to change the kind of a directory with files.
"""
@@ -621,6 +621,25 @@
format = "Conflict: %(path)s is not a directory, but has files in it."\
" %(action)s."
+ def keep_mine(self, tree):
+ # FIXME: we should preserve that path at conflict build time !
+ if self.path.endswith('.new'):
+ conflict_path = self.path[:-(len('.new'))]
+ tree.remove([self.path], force=True, keep_files=False)
+ tree.add(conflict_path)
+ else:
+ raise NotImplementedError(self.keep_mine)
+
+ def take_theirs(self, tree):
+ # FIXME: we should preserve that path at conflict build time !
+ if self.path.endswith('.new'):
+ conflict_path = self.path[:-(len('.new'))]
+ tree.remove([conflict_path], force=True, keep_files=False)
+ tree.rename_one(self.path, conflict_path)
+ else:
+ raise NotImplementedError(self.take_theirs)
+
+
ctype = {}
=== modified file 'bzrlib/tests/test_conflicts.py'
--- a/bzrlib/tests/test_conflicts.py 2009-10-19 17:04:52 +0000
+++ b/bzrlib/tests/test_conflicts.py 2009-10-20 14:47:12 +0000
@@ -598,15 +598,7 @@
2>1 conflicts encountered.
"""
- def test_remove_this(self):
- self.run_script("""
-$ bzr rm foo --force
-$ bzr mv foo.new foo
-$ bzr resolve foo
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
-""")
-
- def test_remove_other(self):
+ def test_keep_mine(self):
self.run_script("""
$ bzr rm foo.new --force
# FIXME: Isn't it weird that foo is now unkown even if foo.new has been put
@@ -616,6 +608,28 @@
$ bzr commit --strict -m 'No more conflicts nor unknown files'
""")
+ def test_take_theirs(self):
+ self.run_script("""
+$ bzr rm foo --force
+$ bzr mv foo.new foo
+$ bzr resolve foo
+$ bzr commit --strict -m 'No more conflicts nor unknown files'
+""")
+
+ def test_resolve_keeping_mine(self):
+ self.run_script("""
+$ bzr resolve --interactive foo.new
+<keep_mine
+$ bzr commit --strict -m 'No more conflicts nor unknown files'
+""")
+
+ def test_resolve_taking_theirs(self):
+ self.run_script("""
+$ bzr resolve --interactive foo.new
+<take_theirs
+$ bzr commit --strict -m 'No more conflicts nor unknown files'
+""")
+
class TestMalformedTransform(script.TestCaseWithTransportAndScript):
More information about the bazaar-commits
mailing list