~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

Merge up bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
                           UnknownFormatError,
40
40
                           UnsupportedFormatError,
41
41
                           )
42
 
from bzrlib.symbol_versioning import (
43
 
    zero_ninetyone,
44
 
    )
45
42
from bzrlib.tests import (
46
43
    TestCase,
47
44
    TestCaseWithTransport,
66
63
        old_format = bzrdir.BzrDirFormat.get_default_format()
67
64
        # default is BzrDirFormat6
68
65
        self.failUnless(isinstance(old_format, bzrdir.BzrDirMetaFormat1))
69
 
        self.applyDeprecated(symbol_versioning.zero_fourteen, 
70
 
                             bzrdir.BzrDirFormat.set_default_format, 
71
 
                             SampleBzrDirFormat())
 
66
        bzrdir.BzrDirFormat._set_default_format(SampleBzrDirFormat())
72
67
        # creating a bzr dir should now create an instrumented dir.
73
68
        try:
74
69
            result = bzrdir.BzrDir.create('memory:///')
75
70
            self.failUnless(isinstance(result, SampleBzrDir))
76
71
        finally:
77
 
            self.applyDeprecated(symbol_versioning.zero_fourteen,
78
 
                bzrdir.BzrDirFormat.set_default_format, old_format)
 
72
            bzrdir.BzrDirFormat._set_default_format(old_format)
79
73
        self.assertEqual(old_format, bzrdir.BzrDirFormat.get_default_format())
80
74
 
81
75
 
281
275
        # now open_downlevel should fail too.
282
276
        self.assertRaises(UnknownFormatError, bzrdir.BzrDir.open_unsupported, url)
283
277
 
284
 
    def test_create_repository_deprecated(self):
285
 
        # new interface is to make the bzrdir, then a repository within that.
286
 
        format = SampleBzrDirFormat()
287
 
        repo = self.applyDeprecated(zero_ninetyone,
288
 
                bzrdir.BzrDir.create_repository,
289
 
                self.get_url(), format=format)
290
 
        self.assertEqual('A repository', repo)
291
 
 
292
 
    def test_create_repository_shared(self):
293
 
        # new interface is to make the bzrdir, then a repository within that.
294
 
        old_format = bzrdir.BzrDirFormat.get_default_format()
295
 
        repo = self.applyDeprecated(zero_ninetyone,
296
 
                bzrdir.BzrDir.create_repository,
297
 
                '.', shared=True)
298
 
        self.assertTrue(repo.is_shared())
299
 
 
300
 
    def test_create_repository_nonshared(self):
301
 
        # new interface is to make the bzrdir, then a repository within that.
302
 
        old_format = bzrdir.BzrDirFormat.get_default_format()
303
 
        repo = self.applyDeprecated(zero_ninetyone,
304
 
                bzrdir.BzrDir.create_repository,
305
 
                '.')
306
 
        self.assertFalse(repo.is_shared())
307
 
 
308
 
    def test_create_repository_under_shared(self):
309
 
        # an explicit create_repository always does so.
310
 
        # we trust the format is right from the 'create_repository test'
311
 
        # new interface is to make the bzrdir, then a repository within that.
312
 
        format = bzrdir.format_registry.make_bzrdir('knit')
313
 
        self.make_repository('.', shared=True, format=format)
314
 
        repo = self.applyDeprecated(zero_ninetyone,
315
 
                bzrdir.BzrDir.create_repository,
316
 
                self.get_url('child'),
317
 
                format=format)
318
 
        self.assertTrue(isinstance(repo, repository.Repository))
319
 
        self.assertTrue(repo.bzrdir.root_transport.base.endswith('child/'))
320
 
 
321
278
    def test_create_branch_and_repo_uses_default(self):
322
279
        format = SampleBzrDirFormat()
323
280
        branch = bzrdir.BzrDir.create_branch_and_repo(self.get_url(),