~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: 2008-12-10 21:06:38 UTC
  • mfrom: (3835.1.18 remote-stacking-graph)
  • Revision ID: pqm@pqm.ubuntu.com-20081210210638-e569azc2bomqq5qx
(abentley) Move RemoteRepository caching to CachingParentsProvider

Show diffs side-by-side

added added

removed removed

Lines of Context:
1236
1236
            repo.get_parent_map, ['a-revision-id'])
1237
1237
 
1238
1238
 
 
1239
class TestGetParentMapAllowsNew(tests.TestCaseWithTransport):
 
1240
 
 
1241
    def test_allows_new_revisions(self):
 
1242
        """get_parent_map's results can be updated by commit."""
 
1243
        smart_server = server.SmartTCPServer_for_testing()
 
1244
        smart_server.setUp()
 
1245
        self.addCleanup(smart_server.tearDown)
 
1246
        self.make_branch('branch')
 
1247
        branch = Branch.open(smart_server.get_url() + '/branch')
 
1248
        tree = branch.create_checkout('tree', lightweight=True)
 
1249
        tree.lock_write()
 
1250
        self.addCleanup(tree.unlock)
 
1251
        graph = tree.branch.repository.get_graph()
 
1252
        # This provides an opportunity for the missing rev-id to be cached.
 
1253
        self.assertEqual({}, graph.get_parent_map(['rev1']))
 
1254
        tree.commit('message', rev_id='rev1')
 
1255
        graph = tree.branch.repository.get_graph()
 
1256
        self.assertEqual({'rev1': ('null:',)}, graph.get_parent_map(['rev1']))
 
1257
 
 
1258
 
1239
1259
class TestRepositoryGetRevisionGraph(TestRemoteRepository):
1240
1260
    
1241
1261
    def test_null_revision(self):
1783
1803
        repo = branch.repository
1784
1804
        self.assertEqual(['rev1'], repo.get_parent_map(['rev1']).keys())
1785
1805
 
1786
 
    def test_stacked__get_parent_map(self):
1787
 
        # the private variant of _get_parent_map ignores stacking
 
1806
    def test_unstacked_get_parent_map(self):
 
1807
        # _unstacked_provider.get_parent_map ignores stacking
1788
1808
        branch = self.prepare_stacked_remote_branch()
1789
 
        repo = branch.repository
1790
 
        self.assertEqual([], repo._get_parent_map(['rev1']).keys())
 
1809
        provider = branch.repository._unstacked_provider
 
1810
        self.assertEqual([], provider.get_parent_map(['rev1']).keys())
1791
1811
 
1792
1812
 
1793
1813
class TestRemoteBranchEffort(tests.TestCaseWithTransport):