Rev 5133: (vila) Handle path conflicts involving different root-ids (Vincent Ladeuil) in file:///home/pqm/archives/thelove/bzr/2.2/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jul 5 11:17:10 UTC 2011


At file:///home/pqm/archives/thelove/bzr/2.2/

------------------------------------------------------------
revno: 5133 [merge]
revision-id: pqm at pqm.ubuntu.com-20110705111707-2bg7h2obs8ig67rq
parent: pqm at pqm.ubuntu.com-20110525182215-rdt09veh6tfzmril
parent: v.ladeuil+lp at free.fr-20110705093225-p1w0eri2tuqwvp1w
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.2
timestamp: Tue 2011-07-05 11:17:07 +0000
message:
  (vila) Handle path conflicts involving different root-ids (Vincent Ladeuil)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
  bzrlib/tests/test_conflicts.py test_conflicts.py-20051006031059-e2dad9bbeaa5891f
=== modified file 'NEWS'
--- a/NEWS	2011-05-17 09:57:58 +0000
+++ b/NEWS	2011-07-05 09:12:52 +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
 ************
 

=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2010-07-29 03:56:54 +0000
+++ b/bzrlib/merge.py	2011-07-05 09:32:25 +0000
@@ -1624,8 +1624,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-01-14 21:35:52 +0000
+++ b/bzrlib/tests/test_conflicts.py	2011-07-05 09:02:05 +0000
@@ -1049,6 +1049,70 @@
 """)
 
 
+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
+$ cd experimental
+# 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>deleted 
+2>modified dir
+2>Committed revision 1.
+# Create an ubuntu branch with yet another root-id
+$ cd ..
+$ bzr init ubuntu
+$ cd ubuntu
+# 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>deleted 
+2>modified dir
+2>Committed revision 1.
+# Now try to merge experimental
+$ bzr merge ../experimental
+2>Path conflict: dir / dir
+2>1 conflicts encountered.
+""")
+
+
 class TestResolveActionOption(tests.TestCase):
 
     def setUp(self):




More information about the bazaar-commits mailing list