1352
1352
self.assertEqual('fail', err._preformatted_string)
1354
1354
def test_post_repo_init(self):
1355
from bzrlib.controldir import RepoInitHookParams
1355
from bzrlib.bzrdir import RepoInitHookParams
1357
1357
bzrdir.BzrDir.hooks.install_named_hook('post_repo_init',
1358
1358
calls.append, None)
1404
1404
def test_supports_colo(self):
1405
1405
format = bzrdir.BzrDirMetaFormat1Colo()
1406
1406
self.assertTrue(format.colocated_branches)
1408
def test_upgrade_from_2a(self):
1409
tree = self.make_branch_and_tree('.', format='2a')
1410
format = bzrdir.BzrDirMetaFormat1Colo()
1411
self.assertTrue(tree.bzrdir.needs_format_conversion(format))
1412
converter = tree.bzrdir._format.get_converter(format)
1413
result = converter.convert(tree.bzrdir, None)
1414
self.assertIsInstance(result._format, bzrdir.BzrDirMetaFormat1Colo)
1415
self.assertFalse(result.needs_format_conversion(format))
1417
def test_downgrade_to_2a(self):
1418
tree = self.make_branch_and_tree('.', format='development-colo')
1419
format = bzrdir.BzrDirMetaFormat1()
1420
self.assertTrue(tree.bzrdir.needs_format_conversion(format))
1421
converter = tree.bzrdir._format.get_converter(format)
1422
result = converter.convert(tree.bzrdir, None)
1423
self.assertIsInstance(result._format, bzrdir.BzrDirMetaFormat1)
1424
self.assertFalse(result.needs_format_conversion(format))
1426
def test_downgrade_to_2a_too_many_branches(self):
1427
tree = self.make_branch_and_tree('.', format='development-colo')
1428
tree.bzrdir.create_branch(name="another-colocated-branch")
1429
converter = tree.bzrdir._format.get_converter(
1430
bzrdir.BzrDirMetaFormat1())
1431
self.assertRaises(errors.BzrError, converter.convert, tree.bzrdir,