Rev 5624: (spiv) Fix AssertionError in RemoteBranchFormat.initialize when reusing a in file:///home/pqm/archives/thelove/bzr/2.3/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Mar 3 02:43:27 UTC 2011
At file:///home/pqm/archives/thelove/bzr/2.3/
------------------------------------------------------------
revno: 5624 [merge]
revision-id: pqm at pqm.ubuntu.com-20110303024323-57o1k07yel87612r
parent: pqm at pqm.ubuntu.com-20110222133954-5yyruujuectfw9uk
parent: andrew.bennetts at canonical.com-20110301071538-jkbhy0xkupfxqwms
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.3
timestamp: Thu 2011-03-03 02:43:23 +0000
message:
(spiv) Fix AssertionError in RemoteBranchFormat.initialize when reusing a
smart transport. (Andrew Bennetts)
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/bzrdir.py bzrdir.py-20061122024551-ol0l0o0oofsu9b3t-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2011-01-10 22:20:12 +0000
+++ b/bzrlib/remote.py 2011-02-28 23:07:53 +0000
@@ -2133,14 +2133,14 @@
repo_format = response_tuple_to_repo_format(response[3:])
repo_path = response[2]
if repository is not None:
- remote_repo_url = urlutils.join(medium.base, repo_path)
+ remote_repo_url = urlutils.join(a_bzrdir.user_url, repo_path)
url_diff = urlutils.relative_url(repository.user_url,
remote_repo_url)
if url_diff != '.':
raise AssertionError(
'repository.user_url %r does not match URL from server '
'response (%r + %r)'
- % (repository.user_url, medium.base, repo_path))
+ % (repository.user_url, a_bzrdir.user_url, repo_path))
remote_repo = repository
else:
if repo_path == '':
=== modified file 'bzrlib/smart/bzrdir.py'
--- a/bzrlib/smart/bzrdir.py 2010-08-28 11:20:04 +0000
+++ b/bzrlib/smart/bzrdir.py 2011-02-28 23:07:53 +0000
@@ -181,7 +181,8 @@
:param path: The path to the bzrdir.
:param network_name: The network name of the branch type to create.
- :return: (ok, network_name)
+ :return: ('ok', branch_format, repo_path, rich_root, tree_ref,
+ external_lookup, repo_format)
"""
bzrdir = BzrDir.open_from_transport(
self.transport_from_client_path(path))
=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py 2011-01-12 01:01:53 +0000
+++ b/bzrlib/tests/test_remote.py 2011-03-01 07:15:38 +0000
@@ -721,6 +721,34 @@
format = branch._format
self.assertEqual(network_name, format.network_name())
+ def test_already_open_repo_and_reused_medium(self):
+ """Bug 726584: create_branch(..., repository=repo) should work
+ regardless of what the smart medium's base URL is.
+ """
+ self.transport_server = test_server.SmartTCPServer_for_testing
+ transport = self.get_transport('.')
+ repo = self.make_repository('quack')
+ # Client's medium rooted a transport root (not at the bzrdir)
+ client = FakeClient(transport.base)
+ transport = transport.clone('quack')
+ reference_bzrdir_format = bzrdir.format_registry.get('default')()
+ reference_format = reference_bzrdir_format.get_branch_format()
+ network_name = reference_format.network_name()
+ reference_repo_fmt = reference_bzrdir_format.repository_format
+ reference_repo_name = reference_repo_fmt.network_name()
+ client.add_expected_call(
+ 'BzrDir.create_branch', ('extra/quack/', network_name),
+ 'success', ('ok', network_name, '', 'no', 'no', 'yes',
+ reference_repo_name))
+ a_bzrdir = RemoteBzrDir(transport, remote.RemoteBzrDirFormat(),
+ _client=client)
+ branch = a_bzrdir.create_branch(repository=repo)
+ # We should have got a remote branch
+ self.assertIsInstance(branch, remote.RemoteBranch)
+ # its format should have the settings from the response
+ format = branch._format
+ self.assertEqual(network_name, format.network_name())
+
class TestBzrDirCreateRepository(TestRemote):
=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt 2011-02-20 15:01:25 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt 2011-03-01 07:15:38 +0000
@@ -35,6 +35,10 @@
* Correctly resolve text conflicts for files in subdirs.
(Vincent Ladeuil, #715058)
+* Fix "AssertionError: repository.user_url ... does not match URL from
+ server response" when reusing a smart transport.
+ (Andrew Bennetts, #726584)
+
* Restore proper logging of bytes transferred. We accidentally reset the
counter when commands finished before we logged the total transferred.
(John Arbash Meinel, #713258)
More information about the bazaar-commits
mailing list