Rev 6013: Handle path conflicts involving different root-ids in http://bazaar.launchpad.net/~vila/bzr/integration/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Thu Jul 7 11:01:00 UTC 2011
At http://bazaar.launchpad.net/~vila/bzr/integration/
------------------------------------------------------------
revno: 6013 [merge]
revision-id: v.ladeuil+lp at free.fr-20110707110100-df1xn1phgvaowjys
parent: pqm at pqm.ubuntu.com-20110707105619-6tftefqyt2zlmho5
parent: v.ladeuil+lp at free.fr-20110707102059-xze39u9kino70aqg
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: trunk
timestamp: Thu 2011-07-07 13:01:00 +0200
message:
Handle path conflicts involving different root-ids
modified:
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/tests/test_conflicts.py test_conflicts.py-20051006031059-e2dad9bbeaa5891f
doc/en/release-notes/bzr-2.2.txt bzr2.2.txt-20101008081016-21wd86gpfhllpue3-39
-------------- next part --------------
=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py 2011-06-28 17:25:26 +0000
+++ b/bzrlib/merge.py 2011-07-06 09:22:00 +0000
@@ -1635,8 +1635,14 @@
if other_parent is None or other_name is None:
other_path = '<deleted>'
else:
- parent_path = fp.get_path(
- self.tt.trans_id_file_id(other_parent))
+ if other_parent == self.other_tree.get_root_id():
+ # The tree transform doesn't know about the other root,
+ # so we special case here to avoid a NoFinalPath
+ # exception
+ parent_path = ''
+ else:
+ parent_path = fp.get_path(
+ self.tt.trans_id_file_id(other_parent))
other_path = osutils.pathjoin(parent_path, other_name)
c = _mod_conflicts.Conflict.factory(
'path conflict', path=this_path,
=== modified file 'bzrlib/tests/test_conflicts.py'
--- a/bzrlib/tests/test_conflicts.py 2011-06-21 15:19:18 +0000
+++ b/bzrlib/tests/test_conflicts.py 2011-07-07 10:20:59 +0000
@@ -1063,6 +1063,91 @@
""")
+class TestNoFinalPath(script.TestCaseWithTransportAndScript):
+
+ def test_bug_805809(self):
+ self.run_script("""
+$ bzr init trunk
+Created a standalone tree (format: 2a)
+$ cd trunk
+$ echo trunk >file
+$ bzr add
+adding file
+$ bzr commit -m 'create file on trunk'
+2>Committing to: .../trunk/
+2>added file
+2>Committed revision 1.
+# Create a debian branch based on trunk
+$ cd ..
+$ bzr branch trunk -r 1 debian
+2>Branched 1 revision(s).
+$ cd debian
+$ mkdir dir
+$ bzr add
+adding dir
+$ bzr mv file dir
+file => dir/file
+$ bzr commit -m 'rename file to dir/file for debian'
+2>Committing to: .../debian/
+2>added dir
+2>renamed file => dir/file
+2>Committed revision 2.
+# Create an experimental branch with a new root-id
+$ cd ..
+$ bzr init experimental
+Created a standalone tree (format: 2a)
+$ cd experimental
+# Work around merging into empty branch not being supported
+# (http://pad.lv/308562)
+$ echo something >not-empty
+$ bzr add
+adding not-empty
+$ bzr commit -m 'Add some content in experimental'
+2>Committing to: .../experimental/
+2>added not-empty
+2>Committed revision 1.
+# merge debian even without a common ancestor
+$ bzr merge ../debian -r0..2
+2>+N dir/
+2>+N dir/file
+2>All changes applied successfully.
+$ bzr commit -m 'merging debian into experimental'
+2>Committing to: .../experimental/
+2>added dir
+2>added dir/file
+2>Committed revision 2.
+# Create an ubuntu branch with yet another root-id
+$ cd ..
+$ bzr init ubuntu
+Created a standalone tree (format: 2a)
+$ cd ubuntu
+# Work around merging into empty branch not being supported
+# (http://pad.lv/308562)
+$ echo something >not-empty-ubuntu
+$ bzr add
+adding not-empty-ubuntu
+$ bzr commit -m 'Add some content in experimental'
+2>Committing to: .../ubuntu/
+2>added not-empty-ubuntu
+2>Committed revision 1.
+# Also merge debian
+$ bzr merge ../debian -r0..2
+2>+N dir/
+2>+N dir/file
+2>All changes applied successfully.
+$ bzr commit -m 'merging debian'
+2>Committing to: .../ubuntu/
+2>added dir
+2>added dir/file
+2>Committed revision 2.
+# Now try to merge experimental
+$ bzr merge ../experimental
+2>+N not-empty
+2>Path conflict: dir / dir
+2>1 conflicts encountered.
+""")
+
+
class TestResolveActionOption(tests.TestCase):
def setUp(self):
=== modified file 'doc/en/release-notes/bzr-2.2.txt'
--- a/doc/en/release-notes/bzr-2.2.txt 2011-03-11 15:19:05 +0000
+++ b/doc/en/release-notes/bzr-2.2.txt 2011-07-06 09:22:00 +0000
@@ -24,6 +24,9 @@
doubly-stacked branch.
(James Westby, Martin Pool, #715000)
+* Don't crash while merging and encountering obscure path conflicts
+ involving different root-ids. (Vincent Ladeuil, #805809)
+
Improvements
************
More information about the bazaar-commits
mailing list