Merge lp:~jameinel/bzr/2.5-remote-branch-initialize-vfs-keeps-repo into lp:bzr/2.5

Proposed by John A Meinel on 2012-09-06
Status: Merged
Approved by: Richard Wilbur on 2012-09-07
Approved revision: 6509
Merged at revision: 6509
Proposed branch: lp:~jameinel/bzr/2.5-remote-branch-initialize-vfs-keeps-repo
Merge into: lp:bzr/2.5
Diff against target: 55 lines (+12/-6)
1 file modified
bzrlib/remote.py (+12/-6)
To merge this branch: bzr merge lp:~jameinel/bzr/2.5-remote-branch-initialize-vfs-keeps-repo
Reviewer Review Type Date Requested Status
Richard Wilbur 2012-09-06 Approve on 2012-09-07
Review via email: mp+123027@code.launchpad.net

Commit message

RemoteBranchFormat.initialize() should pass the repository down to vfs_initialize so that the final branch has the right repository object.

Description of the change

This is a fallout fix from my branch for bug #1046697.

Specifically, if you have a lightweight checkout of a remote repository, and then you try to do:

 wt.bzrdir.sprout('local/path')

It properly creates and initializes a new local repository, fetches the data into it. But then fails with a lock error when it tries to update the branch. This is because RemoteBranchFormat._vfs_initialize was not getting the 'repository' object that was being passed to RemoteBranchFormat.initialize.

The fix is pretty straightforward, but I don't have an associated test case. The test case will be on my lp:~jameinel/bzr/2.5-remote-wt-tests-1046697

To post a comment you must log in.
Richard Wilbur (richard-wilbur) wrote :

Looks like the right thing to do. +1

review: Approve
Richard Wilbur (richard-wilbur) wrote :

Forgot to mention: The fact that this fix is so straightforward and fixes per_workingtree.test_get_parent_ids.TestGetParentIds.test_get_parent_ids on your other branch leads me to believe the testing is sufficient for this merge.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/remote.py'
2--- bzrlib/remote.py 2012-01-28 00:56:56 +0000
3+++ bzrlib/remote.py 2012-09-06 08:29:18 +0000
4@@ -3129,7 +3129,8 @@
5 return a_bzrdir.open_branch(name=name,
6 ignore_fallbacks=ignore_fallbacks)
7
8- def _vfs_initialize(self, a_bzrdir, name, append_revisions_only):
9+ def _vfs_initialize(self, a_bzrdir, name, append_revisions_only,
10+ repository=None):
11 # Initialisation when using a local bzrdir object, or a non-vfs init
12 # method is not available on the server.
13 # self._custom_format is always set - the start of initialize ensures
14@@ -3137,11 +3138,13 @@
15 if isinstance(a_bzrdir, RemoteBzrDir):
16 a_bzrdir._ensure_real()
17 result = self._custom_format.initialize(a_bzrdir._real_bzrdir,
18- name=name, append_revisions_only=append_revisions_only)
19+ name=name, append_revisions_only=append_revisions_only,
20+ repository=repository)
21 else:
22 # We assume the bzrdir is parameterised; it may not be.
23 result = self._custom_format.initialize(a_bzrdir, name=name,
24- append_revisions_only=append_revisions_only)
25+ append_revisions_only=append_revisions_only,
26+ repository=repository)
27 if (isinstance(a_bzrdir, RemoteBzrDir) and
28 not isinstance(result, RemoteBranch)):
29 result = RemoteBranch(a_bzrdir, a_bzrdir.find_repository(), result,
30@@ -3164,11 +3167,13 @@
31 # Being asked to create on a non RemoteBzrDir:
32 if not isinstance(a_bzrdir, RemoteBzrDir):
33 return self._vfs_initialize(a_bzrdir, name=name,
34- append_revisions_only=append_revisions_only)
35+ append_revisions_only=append_revisions_only,
36+ repository=repository)
37 medium = a_bzrdir._client._medium
38 if medium._is_remote_before((1, 13)):
39 return self._vfs_initialize(a_bzrdir, name=name,
40- append_revisions_only=append_revisions_only)
41+ append_revisions_only=append_revisions_only,
42+ repository=repository)
43 # Creating on a remote bzr dir.
44 # 2) try direct creation via RPC
45 path = a_bzrdir._path_for_remote_call(a_bzrdir._client)
46@@ -3182,7 +3187,8 @@
47 # Fallback - use vfs methods
48 medium._remember_remote_is_before((1, 13))
49 return self._vfs_initialize(a_bzrdir, name=name,
50- append_revisions_only=append_revisions_only)
51+ append_revisions_only=append_revisions_only,
52+ repository=repository)
53 if response[0] != 'ok':
54 raise errors.UnexpectedSmartServerResponse(response)
55 # Turn the response into a RemoteRepository object.

Subscribers

People subscribed via source and target branches