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
1=== modified file 'NEWS'
2--- NEWS 2009-06-18 02:01:16 +0000
3+++ NEWS 2009-06-18 04:35:12 +0000
4@@ -25,6 +25,10 @@
5 diverged-branches`` when a push fails because the branches have
6 diverged. (Neil Martinsen-Burrell, #269477)
7
8+* Automatic format upgrades triggered by default stacking policies on a
9+ 1.16rc1 (or later) smart server work again.
10+ (Andrew Bennetts, #388675)
11+
12 * Better message in ``bzr split`` error suggesting a rich root format.
13 (Neil Martinsen-Burrell, #220067)
14
15
16=== modified file 'bzrlib/bzrdir.py'
17--- bzrlib/bzrdir.py 2009-06-12 03:44:12 +0000
18+++ bzrlib/bzrdir.py 2009-06-18 04:35:12 +0000
19@@ -2358,7 +2358,8 @@
20 def set_branch_format(self, format):
21 self._branch_format = format
22
23- def require_stacking(self, stack_on=None, possible_transports=None):
24+ def require_stacking(self, stack_on=None, possible_transports=None,
25+ _skip_repo=False):
26 """We have a request to stack, try to ensure the formats support it.
27
28 :param stack_on: If supplied, it is the URL to a branch that we want to
29@@ -2402,7 +2403,8 @@
30 target[:] = [target_branch, True, False]
31 return target
32
33- if not (self.repository_format.supports_external_lookups):
34+ if (not _skip_repo and
35+ not self.repository_format.supports_external_lookups):
36 # We need to upgrade the Repository.
37 target_branch, _, do_upgrade = get_target_branch()
38 if target_branch is None:
39@@ -3268,6 +3270,10 @@
40 else:
41 remote_repo = None
42 policy = None
43+ if require_stacking:
44+ # The repo has already been created, but we need to make sure that
45+ # we'll make a stackable branch.
46+ bzrdir._format.require_stacking(_skip_repo=True)
47 return remote_repo, bzrdir, require_stacking, policy
48
49 def _open(self, transport):
50
51=== modified file 'bzrlib/tests/bzrdir_implementations/test_bzrdir.py'
52--- bzrlib/tests/bzrdir_implementations/test_bzrdir.py 2009-06-11 03:15:57 +0000
53+++ bzrlib/tests/bzrdir_implementations/test_bzrdir.py 2009-06-18 04:35:12 +0000
54@@ -1275,6 +1275,9 @@
55 fallback_repo = repo._fallback_repositories[0]
56 self.assertEqual(
57 stack_on.base, fallback_repo.bzrdir.root_transport.base)
58+ # The bzrdir creates a branch in stacking-capable format.
59+ new_branch = control.create_branch()
60+ self.assertTrue(new_branch._format.supports_stacking())
61
62 def test_format_initialize_on_transport_ex_repo_fmt_name_None(self):
63 t = self.get_transport('dir')