263
263
client_medium = medium.SmartClientMedium('dummy base')
264
self.assertTrue(client_medium._is_remote_at_least((99, 99)))
264
self.assertFalse(client_medium._is_remote_before((99, 99)))
266
def test__remote_is_not(self):
267
"""Calling _remote_is_not ratchets down the known remote version."""
266
def test__remember_remote_is_before(self):
267
"""Calling _remember_remote_is_before ratchets down the known remote
268
270
client_medium = medium.SmartClientMedium('dummy base')
269
271
# Mark the remote side as being less than 1.6. The remote side may
271
client_medium._remote_is_not((1, 6))
272
self.assertFalse(client_medium._is_remote_at_least((1, 6)))
273
self.assertTrue(client_medium._is_remote_at_least((1, 5)))
274
# Calling _remote_is_not again with a lower value works.
275
client_medium._remote_is_not((1, 5))
276
self.assertFalse(client_medium._is_remote_at_least((1, 5)))
277
# You cannot call _remote_is_not with a larger value.
273
client_medium._remember_remote_is_before((1, 6))
274
self.assertTrue(client_medium._is_remote_before((1, 6)))
275
self.assertFalse(client_medium._is_remote_before((1, 5)))
276
# Calling _remember_remote_is_before again with a lower value works.
277
client_medium._remember_remote_is_before((1, 5))
278
self.assertTrue(client_medium._is_remote_before((1, 5)))
279
# You cannot call _remember_remote_is_before with a larger value.
278
280
self.assertRaises(
279
AssertionError, client_medium._remote_is_not, (1, 9))
281
AssertionError, client_medium._remember_remote_is_before, (1, 9))
282
284
class TestBzrDirOpenBranch(tests.TestCase):
924
926
repo, client = self.setup_fake_client_and_repository(transport_path)
925
927
client.add_unknown_method_response('Repository,get_parent_map')
926
928
client.add_success_response_with_body('', 'ok')
927
self.assertTrue(client._medium._is_remote_at_least((1, 2)))
929
self.assertFalse(client._medium._is_remote_before((1, 2)))
928
930
rev_id = 'revision-id'
929
931
expected_deprecations = [
930
932
'bzrlib.remote.RemoteRepository.get_revision_graph was deprecated '
939
941
('quack/', ''))],
941
943
# The medium is now marked as being connected to an older server
942
self.assertFalse(client._medium._is_remote_at_least((1, 2)))
944
self.assertTrue(client._medium._is_remote_before((1, 2)))
944
946
def test_get_parent_map_fallback_parentless_node(self):
945
947
"""get_parent_map falls back to get_revision_graph on old servers. The
956
958
transport_path = 'quack'
957
959
repo, client = self.setup_fake_client_and_repository(transport_path)
958
960
client.add_success_response_with_body(rev_id, 'ok')
959
client._medium._remote_is_not((1, 2))
961
client._medium._remember_remote_is_before((1, 2))
960
962
expected_deprecations = [
961
963
'bzrlib.remote.RemoteRepository.get_revision_graph was deprecated '
962
964
'in version 1.4.']