Rev 3397: (jam) Fix RemoteRepository.get_parent_map() when server is <v1.2 in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu May 1 10:15:22 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3397
revision-id:pqm at pqm.ubuntu.com-20080501091514-61b80pvo69wnhf2t
parent: pqm at pqm.ubuntu.com-20080501070304-s4tdgkmt0ghea1i1
parent: andrew.bennetts at canonical.com-20080501021559-mhydylxp2la4guo6
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-05-01 10:15:14 +0100
message:
(jam) Fix RemoteRepository.get_parent_map() when server is <v1.2
(#214894)
modified:
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
------------------------------------------------------------
revno: 3389.1.3
revision-id:andrew.bennetts at canonical.com-20080501021559-mhydylxp2la4guo6
parent: andrew.bennetts at canonical.com-20080430233632-0hrshmlsdhdkiwcq
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: johns-bug
timestamp: Thu 2008-05-01 12:15:59 +1000
message:
Remove XXX from test description.
modified:
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
------------------------------------------------------------
revno: 3389.1.2
revision-id:andrew.bennetts at canonical.com-20080430233632-0hrshmlsdhdkiwcq
parent: john at arbash-meinel.com-20080429200228-ubbv2h0sqtrt0tsi
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: johns-bug
timestamp: Thu 2008-05-01 09:36:32 +1000
message:
Add test for the bug John found.
modified:
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py 2008-04-08 07:44:39 +0000
+++ b/bzrlib/tests/test_remote.py 2008-05-01 02:15:59 +0000
@@ -829,6 +829,7 @@
transport_path = 'quack'
repo, client = self.setup_fake_client_and_repository(
responses, transport_path)
+ self.assertTrue(client._medium._remote_is_at_least_1_2)
rev_id = 'revision-id'
expected_deprecations = [
'bzrlib.remote.RemoteRepository.get_revision_graph was deprecated '
@@ -842,6 +843,36 @@
('call_expecting_body', 'Repository.get_revision_graph',
('quack/', ''))],
client._calls)
+ # The medium is now marked as being connected to an older server
+ self.assertFalse(client._medium._remote_is_at_least_1_2)
+
+ def test_get_parent_map_fallback_parentless_node(self):
+ """get_parent_map falls back to get_revision_graph on old servers. The
+ results from get_revision_graph are tweaked to match the get_parent_map
+ API.
+
+ Specifically, a {key: ()} result from get_revision_graph means "no
+ parents" for that key, which in get_parent_map results should be
+ represented as {key: ('null:',)}.
+
+ This is the test for https://bugs.launchpad.net/bzr/+bug/214894
+ """
+ rev_id = 'revision-id'
+ responses = [(('ok',), rev_id)]
+ transport_path = 'quack'
+ repo, client = self.setup_fake_client_and_repository(
+ responses, transport_path)
+ client._medium._remote_is_at_least_1_2 = False
+ expected_deprecations = [
+ 'bzrlib.remote.RemoteRepository.get_revision_graph was deprecated '
+ 'in version 1.4.']
+ parents = self.callDeprecated(
+ expected_deprecations, repo.get_parent_map, [rev_id])
+ self.assertEqual(
+ [('call_expecting_body', 'Repository.get_revision_graph',
+ ('quack/', ''))],
+ client._calls)
+ self.assertEqual({rev_id: ('null:',)}, parents)
def test_get_parent_map_unexpected_response(self):
responses = [
More information about the bazaar-commits
mailing list