~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2011-10-11 20:18:09 UTC
  • mto: This revision was merged to the branch mainline in revision 6208.
  • Revision ID: jelmer@samba.org-20111011201809-apxml9aoaakkie53
Support upgrading between 2a and development-colo.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1404
1404
    def test_supports_colo(self):
1405
1405
        format = bzrdir.BzrDirMetaFormat1Colo()
1406
1406
        self.assertTrue(format.colocated_branches)
 
1407
 
 
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))
 
1416
 
 
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))
 
1425
 
 
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,
 
1432
            None)