~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_remote.py

  • Committer: Andrew Bennetts
  • Date: 2009-03-23 03:20:02 UTC
  • mto: This revision was merged to the branch mainline in revision 4194.
  • Revision ID: andrew.bennetts@canonical.com-20090323032002-q2rbmpp5ne255d46
Fix BzrDir.cloning_metadir RPC to fail on branch references, and make
RemoteBzrDir cope with that by opening the referenced branch and asking it for
the cloning_metadir.  This can cause extra round trips, but only for callers
that haven't already resolved branch references, which only occurs in our test
suite, not UI code.

This theoretically breaks 1.13 clients that depend on the cloning_metadir RPC
resolving the reference for them, but again that never happens via any builtin
commands, and the new branch-open jail has already broken those clients.

Show diffs side-by-side

added added

removed removed

Lines of Context:
407
407
            call.call.method == verb])
408
408
        self.assertEqual(1, call_count)
409
409
 
 
410
    def test_branch_reference(self):
 
411
        transport = self.get_transport('quack')
 
412
        referenced = self.make_branch('referenced')
 
413
        expected = referenced.bzrdir.cloning_metadir()
 
414
        client = FakeClient(transport.base)
 
415
        client.add_expected_call(
 
416
            'BzrDir.cloning_metadir', ('quack/', 'False'),
 
417
            'error', ('BranchReference',)),
 
418
        client.add_expected_call(
 
419
            'BzrDir.open_branchV2', ('quack/',),
 
420
            'success', ('ref', self.get_url('referenced'))),
 
421
        a_bzrdir = RemoteBzrDir(transport, remote.RemoteBzrDirFormat(),
 
422
            _client=client)
 
423
        result = a_bzrdir.cloning_metadir()
 
424
        # We should have got a control dir matching the referenced branch.
 
425
        self.assertEqual(bzrdir.BzrDirMetaFormat1, type(result))
 
426
        self.assertEqual(expected._repository_format, result._repository_format)
 
427
        self.assertEqual(expected._branch_format, result._branch_format)
 
428
        client.finished_test()
 
429
 
410
430
    def test_current_server(self):
411
431
        transport = self.get_transport('.')
412
432
        transport = transport.clone('quack')