Merge lp:~spiv/bzr/default-stacking-again into lp:~bzr/bzr/trunk-old

Proposed by Andrew Bennetts
Status: Merged
Merged at revision: not available
Proposed branch: lp:~spiv/bzr/default-stacking-again
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 63 lines
To merge this branch: bzr merge lp:~spiv/bzr/default-stacking-again
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+7601@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Andrew Bennetts (spiv) wrote :

Fix for bug 388675. When using the BzrDirFormat.initialize_ex_1.16 verb the wrong branch format was created by the client if stacking was triggered by a default stacking policy. The cause was that in that case require_stacking() wasn't being triggered in the client, just server-side, but it's the client that chooses the branch format.

So this patch simply makes sure require_stacking() is called if the server requires stacking. This may be a candidate for cherrypicking into 1.16...

Revision history for this message
Robert Collins (lifeless) wrote :

On Thu, 2009-06-18 at 03:55 +0000, Andrew Bennetts wrote:
>
>
> So this patch simply makes sure require_stacking() is called if the
> server requires stacking. This may be a candidate for cherrypicking
> into 1.16...

 review +1

seems to be some noise in the diff

review: Approve
Revision history for this message
Andrew Bennetts (spiv) wrote :

(Btw, if we want to include this in 1.16, there's a cherry-pick integrated at: lp:~spiv/bzr/bzr-1.16)

Revision history for this message
Andrew Bennetts (spiv) wrote :

> review +1
>
> seems to be some noise in the diff

Yeah, odd. Perhaps lp's copy of bzr.dev is a bit out of date?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2009-06-18 02:01:16 +0000
+++ NEWS 2009-06-18 04:35:12 +0000
@@ -25,6 +25,10 @@
25 diverged-branches`` when a push fails because the branches have25 diverged-branches`` when a push fails because the branches have
26 diverged. (Neil Martinsen-Burrell, #269477)26 diverged. (Neil Martinsen-Burrell, #269477)
2727
28* Automatic format upgrades triggered by default stacking policies on a
29 1.16rc1 (or later) smart server work again.
30 (Andrew Bennetts, #388675)
31
28* Better message in ``bzr split`` error suggesting a rich root format.32* Better message in ``bzr split`` error suggesting a rich root format.
29 (Neil Martinsen-Burrell, #220067)33 (Neil Martinsen-Burrell, #220067)
3034
3135
=== modified file 'bzrlib/bzrdir.py'
--- bzrlib/bzrdir.py 2009-06-12 03:44:12 +0000
+++ bzrlib/bzrdir.py 2009-06-18 04:35:12 +0000
@@ -2358,7 +2358,8 @@
2358 def set_branch_format(self, format):2358 def set_branch_format(self, format):
2359 self._branch_format = format2359 self._branch_format = format
23602360
2361 def require_stacking(self, stack_on=None, possible_transports=None):2361 def require_stacking(self, stack_on=None, possible_transports=None,
2362 _skip_repo=False):
2362 """We have a request to stack, try to ensure the formats support it.2363 """We have a request to stack, try to ensure the formats support it.
23632364
2364 :param stack_on: If supplied, it is the URL to a branch that we want to2365 :param stack_on: If supplied, it is the URL to a branch that we want to
@@ -2402,7 +2403,8 @@
2402 target[:] = [target_branch, True, False]2403 target[:] = [target_branch, True, False]
2403 return target2404 return target
24042405
2405 if not (self.repository_format.supports_external_lookups):2406 if (not _skip_repo and
2407 not self.repository_format.supports_external_lookups):
2406 # We need to upgrade the Repository.2408 # We need to upgrade the Repository.
2407 target_branch, _, do_upgrade = get_target_branch()2409 target_branch, _, do_upgrade = get_target_branch()
2408 if target_branch is None:2410 if target_branch is None:
@@ -3268,6 +3270,10 @@
3268 else:3270 else:
3269 remote_repo = None3271 remote_repo = None
3270 policy = None3272 policy = None
3273 if require_stacking:
3274 # The repo has already been created, but we need to make sure that
3275 # we'll make a stackable branch.
3276 bzrdir._format.require_stacking(_skip_repo=True)
3271 return remote_repo, bzrdir, require_stacking, policy3277 return remote_repo, bzrdir, require_stacking, policy
32723278
3273 def _open(self, transport):3279 def _open(self, transport):
32743280
=== modified file 'bzrlib/tests/bzrdir_implementations/test_bzrdir.py'
--- bzrlib/tests/bzrdir_implementations/test_bzrdir.py 2009-06-11 03:15:57 +0000
+++ bzrlib/tests/bzrdir_implementations/test_bzrdir.py 2009-06-18 04:35:12 +0000
@@ -1275,6 +1275,9 @@
1275 fallback_repo = repo._fallback_repositories[0]1275 fallback_repo = repo._fallback_repositories[0]
1276 self.assertEqual(1276 self.assertEqual(
1277 stack_on.base, fallback_repo.bzrdir.root_transport.base)1277 stack_on.base, fallback_repo.bzrdir.root_transport.base)
1278 # The bzrdir creates a branch in stacking-capable format.
1279 new_branch = control.create_branch()
1280 self.assertTrue(new_branch._format.supports_stacking())
12781281
1279 def test_format_initialize_on_transport_ex_repo_fmt_name_None(self):1282 def test_format_initialize_on_transport_ex_repo_fmt_name_None(self):
1280 t = self.get_transport('dir')1283 t = self.get_transport('dir')