~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_remote.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-24 01:08:12 UTC
  • mfrom: (3948.3.9 deprecation)
  • Revision ID: pqm@pqm.ubuntu.com-20090324010812-lrfx6zoeu7q0fftv
(mbp) remove code deprecated up to 1.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2008, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
52
52
from bzrlib.revision import NULL_REVISION
53
53
from bzrlib.smart import server, medium
54
54
from bzrlib.smart.client import _SmartClient
55
 
from bzrlib.symbol_versioning import one_four
56
55
from bzrlib.tests import (
57
56
    condition_isinstance,
58
57
    split_suite_by_condition,
1577
1576
 
1578
1577
    def test_get_parent_map_reconnects_if_unknown_method(self):
1579
1578
        transport_path = 'quack'
 
1579
        rev_id = 'revision-id'
1580
1580
        repo, client = self.setup_fake_client_and_repository(transport_path)
1581
 
        client.add_unknown_method_response('Repository,get_parent_map')
1582
 
        client.add_success_response_with_body('', 'ok')
 
1581
        client.add_unknown_method_response('Repository.get_parent_map')
 
1582
        client.add_success_response_with_body(rev_id, 'ok')
1583
1583
        self.assertFalse(client._medium._is_remote_before((1, 2)))
1584
 
        rev_id = 'revision-id'
1585
 
        expected_deprecations = [
1586
 
            'bzrlib.remote.RemoteRepository.get_revision_graph was deprecated '
1587
 
            'in version 1.4.']
1588
 
        parents = self.callDeprecated(
1589
 
            expected_deprecations, repo.get_parent_map, [rev_id])
 
1584
        parents = repo.get_parent_map([rev_id])
1590
1585
        self.assertEqual(
1591
1586
            [('call_with_body_bytes_expecting_body',
1592
1587
              'Repository.get_parent_map', ('quack/', rev_id), '\n\n0'),
1596
1591
            client._calls)
1597
1592
        # The medium is now marked as being connected to an older server
1598
1593
        self.assertTrue(client._medium._is_remote_before((1, 2)))
 
1594
        self.assertEqual({rev_id: ('null:',)}, parents)
1599
1595
 
1600
1596
    def test_get_parent_map_fallback_parentless_node(self):
1601
1597
        """get_parent_map falls back to get_revision_graph on old servers.  The
1613
1609
        repo, client = self.setup_fake_client_and_repository(transport_path)
1614
1610
        client.add_success_response_with_body(rev_id, 'ok')
1615
1611
        client._medium._remember_remote_is_before((1, 2))
1616
 
        expected_deprecations = [
1617
 
            'bzrlib.remote.RemoteRepository.get_revision_graph was deprecated '
1618
 
            'in version 1.4.']
1619
 
        parents = self.callDeprecated(
1620
 
            expected_deprecations, repo.get_parent_map, [rev_id])
 
1612
        parents = repo.get_parent_map([rev_id])
1621
1613
        self.assertEqual(
1622
1614
            [('call_expecting_body', 'Repository.get_revision_graph',
1623
1615
             ('quack/', ''))],
1660
1652
        transport_path = 'empty'
1661
1653
        repo, client = self.setup_fake_client_and_repository(transport_path)
1662
1654
        client.add_success_response('notused')
1663
 
        result = self.applyDeprecated(one_four, repo.get_revision_graph,
1664
 
            NULL_REVISION)
 
1655
        # actual RemoteRepository.get_revision_graph is gone, but there's an
 
1656
        # equivalent private method for testing
 
1657
        result = repo._get_revision_graph(NULL_REVISION)
1665
1658
        self.assertEqual([], client._calls)
1666
1659
        self.assertEqual({}, result)
1667
1660
 
1675
1668
        transport_path = 'sinhala'
1676
1669
        repo, client = self.setup_fake_client_and_repository(transport_path)
1677
1670
        client.add_success_response_with_body(encoded_body, 'ok')
1678
 
        result = self.applyDeprecated(one_four, repo.get_revision_graph)
 
1671
        # actual RemoteRepository.get_revision_graph is gone, but there's an
 
1672
        # equivalent private method for testing
 
1673
        result = repo._get_revision_graph(None)
1679
1674
        self.assertEqual(
1680
1675
            [('call_expecting_body', 'Repository.get_revision_graph',
1681
1676
             ('sinhala/', ''))],
1694
1689
        transport_path = 'sinhala'
1695
1690
        repo, client = self.setup_fake_client_and_repository(transport_path)
1696
1691
        client.add_success_response_with_body(encoded_body, 'ok')
1697
 
        result = self.applyDeprecated(one_four, repo.get_revision_graph, r2)
 
1692
        result = repo._get_revision_graph(r2)
1698
1693
        self.assertEqual(
1699
1694
            [('call_expecting_body', 'Repository.get_revision_graph',
1700
1695
             ('sinhala/', r2))],
1708
1703
        client.add_error_response('nosuchrevision', revid)
1709
1704
        # also check that the right revision is reported in the error
1710
1705
        self.assertRaises(errors.NoSuchRevision,
1711
 
            self.applyDeprecated, one_four, repo.get_revision_graph, revid)
 
1706
            repo._get_revision_graph, revid)
1712
1707
        self.assertEqual(
1713
1708
            [('call_expecting_body', 'Repository.get_revision_graph',
1714
1709
             ('sinhala/', revid))],
1720
1715
        repo, client = self.setup_fake_client_and_repository(transport_path)
1721
1716
        client.add_error_response('AnUnexpectedError')
1722
1717
        e = self.assertRaises(errors.UnknownErrorFromSmartServer,
1723
 
            self.applyDeprecated, one_four, repo.get_revision_graph, revid)
 
1718
            repo._get_revision_graph, revid)
1724
1719
        self.assertEqual(('AnUnexpectedError',), e.error_tuple)
1725
1720
 
1726
1721