~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_controldir/test_controldir.py

  • Committer: Jelmer Vernooij
  • Date: 2010-08-23 20:37:18 UTC
  • mto: This revision was merged to the branch mainline in revision 5389.
  • Revision ID: jelmer@samba.org-20100823203718-1fj7rrjsiaxedkp7
Provide bzrlib.bzrdir.format_registry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    controldir,
30
30
    errors,
31
31
    gpg,
32
 
    lockdir,
33
32
    osutils,
34
 
    repository,
35
33
    revision as _mod_revision,
36
 
    transactions,
37
34
    transport,
38
35
    ui,
39
36
    urlutils,
40
37
    workingtree,
41
38
    )
42
 
from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
43
 
from bzrlib.errors import (FileExists,
44
 
                           NoSuchRevision,
45
 
                           NoSuchFile,
46
 
                           UninitializableFormat,
 
39
from bzrlib.errors import (NoSuchRevision,
47
40
                           NotBranchError,
48
41
                           )
49
42
import bzrlib.revision
50
43
from bzrlib.tests import (
51
44
                          ChrootedTestCase,
52
 
                          TestCase,
53
 
                          TestCaseWithTransport,
54
45
                          TestNotApplicable,
55
46
                          TestSkipped,
56
47
                          )
63
54
from bzrlib.repofmt import weaverepo
64
55
 
65
56
 
66
 
class TestBzrDir(TestCaseWithControlDir):
 
57
class TestControlDir(TestCaseWithControlDir):
67
58
    # Many of these tests test for disk equality rather than checking
68
59
    # for semantic equivalence. This works well for some tests but
69
60
    # is not good at handling changes in representation or the addition
263
254
        bzrdir.open_repository()
264
255
 
265
256
    def test_open_workingtree_raises_no_working_tree(self):
266
 
        """BzrDir.open_workingtree() should raise NoWorkingTree (rather than
 
257
        """ControlDir.open_workingtree() should raise NoWorkingTree (rather than
267
258
        e.g. NotLocalUrl) if there is no working tree.
268
259
        """
269
260
        dir = self.make_bzrdir('source')
270
261
        vfs_dir = bzrdir.BzrDir.open(self.get_vfs_only_url('source'))
271
262
        if vfs_dir.has_workingtree():
272
 
            # This BzrDir format doesn't support BzrDirs without working trees,
273
 
            # so this test is irrelevant.
 
263
            # This ControlDir format doesn't support ControlDirs without
 
264
            # working trees, so this test is irrelevant.
274
265
            return
275
266
        self.assertRaises(errors.NoWorkingTree, dir.open_workingtree)
276
267
 
1207
1198
        t = transport.get_transport(self.get_url())
1208
1199
        readonly_t = transport.get_transport(self.get_readonly_url())
1209
1200
        made_control = self.bzrdir_format.initialize(t.base)
1210
 
        self.failUnless(isinstance(made_control, bzrdir.BzrDir))
 
1201
        self.failUnless(isinstance(made_control, controldir.ControlDir))
1211
1202
        self.assertEqual(self.bzrdir_format,
1212
1203
                         controldir.ControlDirFormat.find_format(readonly_t))
1213
1204
        direct_opened_dir = self.bzrdir_format.open(readonly_t)
1216
1207
                         opened_dir._format)
1217
1208
        self.assertEqual(direct_opened_dir._format,
1218
1209
                         opened_dir._format)
1219
 
        self.failUnless(isinstance(opened_dir, bzrdir.BzrDir))
 
1210
        self.failUnless(isinstance(opened_dir, controldir.ControlDir))
1220
1211
 
1221
1212
    def test_format_initialize_on_transport_ex(self):
1222
1213
        t = self.get_transport('dir')
1766
1757
            self.assertTrue(isinstance(dir._format.get_converter(
1767
1758
                format=dir._format), bzrdir.Converter))
1768
1759
        dir.needs_format_conversion(
1769
 
            bzrdir.BzrDirFormat.get_default_format())
 
1760
            controldir.ControlDirFormat.get_default_format())
1770
1761
 
1771
1762
    def test_backup_copies_existing(self):
1772
1763
        tree = self.make_branch_and_tree('test')
1965
1956
        self.assertEqual('http://example.com', config2.get_default_stack_on())
1966
1957
 
1967
1958
 
1968
 
class ChrootedBzrDirTests(ChrootedTestCase):
 
1959
class ChrootedControlDirTests(ChrootedTestCase):
1969
1960
 
1970
1961
    def test_find_repository_no_repository(self):
1971
1962
        # loopback test to check the current format fails to find a
1993
1984
                          made_control.find_repository)
1994
1985
 
1995
1986
 
1996
 
class TestBzrDirControlComponent(TestCaseWithControlDir):
1997
 
    """BzrDir implementations adequately implement ControlComponent."""
 
1987
class TestControlDirControlComponent(TestCaseWithControlDir):
 
1988
    """ControlDir implementations adequately implement ControlComponent."""
1998
1989
 
1999
1990
    def test_urls(self):
2000
1991
        bd = self.make_bzrdir('bd')