459
459
RemoteBzrDirFormat.probe_transport, OldServerTransport())
462
class TestBzrDirCreateBranch(TestRemote):
464
def test_backwards_compat(self):
465
self.setup_smart_server_with_call_log()
466
repo = self.make_repository('.')
467
self.reset_smart_call_log()
468
self.disable_verb('BzrDir.create_branch')
469
branch = repo.bzrdir.create_branch()
470
create_branch_call_count = len([call for call in self.hpss_calls if
471
call[0].method == 'BzrDir.create_branch'])
472
self.assertEqual(1, create_branch_call_count)
474
def test_current_server(self):
475
transport = self.get_transport('.')
476
transport = transport.clone('quack')
477
self.make_repository('quack')
478
client = FakeClient(transport.base)
479
reference_bzrdir_format = bzrdir.format_registry.get('default')()
480
reference_format = reference_bzrdir_format.get_branch_format()
481
network_name = reference_format.network_name()
482
reference_repo_fmt = reference_bzrdir_format.repository_format
483
reference_repo_name = reference_repo_fmt.network_name()
484
client.add_expected_call(
485
'BzrDir.create_branch', ('quack/', network_name),
486
'success', ('ok', network_name, '', 'no', 'no', 'yes',
487
reference_repo_name))
488
a_bzrdir = RemoteBzrDir(transport, remote.RemoteBzrDirFormat(),
490
branch = a_bzrdir.create_branch()
491
# We should have got a remote branch
492
self.assertIsInstance(branch, remote.RemoteBranch)
493
# its format should have the settings from the response
494
format = branch._format
495
self.assertEqual(network_name, format.network_name())
462
498
class TestBzrDirCreateRepository(TestRemote):
464
500
def test_backwards_compat(self):
831
867
branch = self.make_remote_branch(transport, client)
832
868
branch._ensure_real = lambda: None
833
869
branch.lock_write()
834
self.addCleanup(branch.unlock)
835
870
# The 'TipChangeRejected' error response triggered by calling
836
871
# set_revision_history causes a TipChangeRejected exception.
837
872
err = self.assertRaises(