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,
66
bzrdir.BzrDirFormat._set_default_format(SampleBzrDirFormat())
72
67
# creating a bzr dir should now create an instrumented dir.
74
69
result = bzrdir.BzrDir.create('memory:///')
75
70
self.failUnless(isinstance(result, SampleBzrDir))
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())
281
275
# now open_downlevel should fail too.
282
276
self.assertRaises(UnknownFormatError, bzrdir.BzrDir.open_unsupported, url)
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)
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,
298
self.assertTrue(repo.is_shared())
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,
306
self.assertFalse(repo.is_shared())
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'),
318
self.assertTrue(isinstance(repo, repository.Repository))
319
self.assertTrue(repo.bzrdir.root_transport.base.endswith('child/'))
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(),