Merge lp:~vila/bzr/805809-no-final-path into lp:bzr/2.2

Proposed by Vincent Ladeuil
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 5133
Proposed branch: lp:~vila/bzr/805809-no-final-path
Merge into: lp:bzr/2.2
Diff against target: 109 lines (+75/-2)
3 files modified
NEWS (+3/-0)
bzrlib/merge.py (+8/-2)
bzrlib/tests/test_conflicts.py (+64/-0)
To merge this branch: bzr merge lp:~vila/bzr/805809-no-final-path
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+66868@code.launchpad.net

Commit message

Handle path conflicts involving different root-ids

Description of the change

The path conflicts involving the root-ids are still a bit obscure
but roughly in this case, we don't inject the root path for the
branch we are merging from in the tree transform (and I can't see
why we should).

The fix is minimal as I target 2.2 but I'm not sure it's worth
digging for a better fix for now.

I'll check what will happen when merging up in 2.3 and 2.4 but
some earlier tests showed that the fix is valid for trunk too.

The "bad" news is that this will require a bzr upgrade on jubany
to fix the corresponding failures (31), but I'll care about that
once this patch has landed.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 7/5/2011 11:19 AM, Vincent Ladeuil wrote:
> Vincent Ladeuil has proposed merging lp:~vila/bzr/805809-no-final-path into lp:bzr/2.2.
>
> Requested reviews:
> bzr-core (bzr-core)
> Related bugs:
> Bug #805809 in Bazaar: "merge fails with NoFinalPath"
> https://bugs.launchpad.net/bzr/+bug/805809
>
> For more details, see:
> https://code.launchpad.net/~vila/bzr/805809-no-final-path/+merge/66868
>
> The path conflicts involving the root-ids are still a bit obscure
> but roughly in this case, we don't inject the root path for the
> branch we are merging from in the tree transform (and I can't see
> why we should).
>
> The fix is minimal as I target 2.2 but I'm not sure it's worth
> digging for a better fix for now.
>
> I'll check what will happen when merging up in 2.3 and 2.4 but
> some earlier tests showed that the fix is valid for trunk too.
>
> The "bad" news is that this will require a bzr upgrade on jubany
> to fix the corresponding failures (31), but I'll care about that
> once this patch has landed.
>

- - 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 don't know about the other
root,
+ # so we special case here to avoid a NoFinalPath
+ # exception
+ parent_path = ''

^- "doesn't know about"

 merge: approve

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4S3DkACgkQJdeBCYSNAAOUzgCfdnwcNATvOnd40oqy1N4DJrZZ
aZgAoMCGCU8ZfufSZOOTSNPqA0dXjq4q
=b6VC
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
Vincent Ladeuil (vila) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2011-05-17 09:57:58 +0000
+++ NEWS 2011-07-05 09:34:35 +0000
@@ -24,6 +24,9 @@
24 doubly-stacked branch.24 doubly-stacked branch.
25 (James Westby, Martin Pool, #715000)25 (James Westby, Martin Pool, #715000)
2626
27* Don't crash while merging and encountering obscure path conflicts
28 involving different root-ids. (Vincent Ladeuil, #805809)
29
27Improvements30Improvements
28************31************
2932
3033
=== modified file 'bzrlib/merge.py'
--- bzrlib/merge.py 2010-07-29 03:56:54 +0000
+++ bzrlib/merge.py 2011-07-05 09:34:35 +0000
@@ -1624,8 +1624,14 @@
1624 if other_parent is None or other_name is None:1624 if other_parent is None or other_name is None:
1625 other_path = '<deleted>'1625 other_path = '<deleted>'
1626 else:1626 else:
1627 parent_path = fp.get_path(1627 if other_parent == self.other_tree.get_root_id():
1628 self.tt.trans_id_file_id(other_parent))1628 # The tree transform doesn't know about the other root,
1629 # so we special case here to avoid a NoFinalPath
1630 # exception
1631 parent_path = ''
1632 else:
1633 parent_path = fp.get_path(
1634 self.tt.trans_id_file_id(other_parent))
1629 other_path = osutils.pathjoin(parent_path, other_name)1635 other_path = osutils.pathjoin(parent_path, other_name)
1630 c = _mod_conflicts.Conflict.factory(1636 c = _mod_conflicts.Conflict.factory(
1631 'path conflict', path=this_path,1637 'path conflict', path=this_path,
16321638
=== modified file 'bzrlib/tests/test_conflicts.py'
--- bzrlib/tests/test_conflicts.py 2011-01-14 21:35:52 +0000
+++ bzrlib/tests/test_conflicts.py 2011-07-05 09:34:35 +0000
@@ -1049,6 +1049,70 @@
1049""")1049""")
10501050
10511051
1052class TestNoFinalPath(script.TestCaseWithTransportAndScript):
1053
1054 def test_bug_805809(self):
1055 self.run_script("""
1056$ bzr init trunk
1057Created a standalone tree (format: 2a)
1058$ cd trunk
1059$ echo trunk >file
1060$ bzr add
1061adding file
1062$ bzr commit -m 'create file on trunk'
10632>Committing to: .../trunk/
10642>added file
10652>Committed revision 1.
1066# Create a debian branch based on trunk
1067$ cd ..
1068$ bzr branch trunk -r 1 debian
10692>Branched 1 revision(s).
1070$ cd debian
1071$ mkdir dir
1072$ bzr add
1073adding dir
1074$ bzr mv file dir
1075file => dir/file
1076$ bzr commit -m 'rename file to dir/file for debian'
10772>Committing to: .../debian/
10782>added dir
10792>renamed file => dir/file
10802>Committed revision 2.
1081# Create an experimental branch with a new root-id
1082$ cd ..
1083$ bzr init experimental
1084$ cd experimental
1085# merge debian even without a common ancestor
1086$ bzr merge ../debian -r0..2
10872>+N dir/
10882>+N dir/file
10892>All changes applied successfully.
1090$ bzr commit -m 'merging debian into experimental'
10912>Committing to: .../experimental/
10922>deleted
10932>modified dir
10942>Committed revision 1.
1095# Create an ubuntu branch with yet another root-id
1096$ cd ..
1097$ bzr init ubuntu
1098$ cd ubuntu
1099# Also merge debian
1100$ bzr merge ../debian -r0..2
11012>+N dir/
11022>+N dir/file
11032>All changes applied successfully.
1104$ bzr commit -m 'merging debian'
11052>Committing to: .../ubuntu/
11062>deleted
11072>modified dir
11082>Committed revision 1.
1109# Now try to merge experimental
1110$ bzr merge ../experimental
11112>Path conflict: dir / dir
11122>1 conflicts encountered.
1113""")
1114
1115
1052class TestResolveActionOption(tests.TestCase):1116class TestResolveActionOption(tests.TestCase):
10531117
1054 def setUp(self):1118 def setUp(self):

Subscribers

People subscribed via source and target branches