1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
261
264
# now open_downlevel should fail too.
262
265
self.assertRaises(UnknownFormatError, bzrdir.BzrDir.open_unsupported, url)
264
def test_create_repository(self):
267
def test_create_repository_deprecated(self):
268
# new interface is to make the bzrdir, then a repository within that.
265
269
format = SampleBzrDirFormat()
266
repo = bzrdir.BzrDir.create_repository(self.get_url(), format=format)
270
repo = self.applyDeprecated(zero_ninetyone,
271
bzrdir.BzrDir.create_repository,
272
self.get_url(), format=format)
267
273
self.assertEqual('A repository', repo)
269
275
def test_create_repository_shared(self):
276
# new interface is to make the bzrdir, then a repository within that.
270
277
old_format = bzrdir.BzrDirFormat.get_default_format()
271
repo = bzrdir.BzrDir.create_repository('.', shared=True)
278
repo = self.applyDeprecated(zero_ninetyone,
279
bzrdir.BzrDir.create_repository,
272
281
self.assertTrue(repo.is_shared())
274
283
def test_create_repository_nonshared(self):
284
# new interface is to make the bzrdir, then a repository within that.
275
285
old_format = bzrdir.BzrDirFormat.get_default_format()
276
repo = bzrdir.BzrDir.create_repository('.')
286
repo = self.applyDeprecated(zero_ninetyone,
287
bzrdir.BzrDir.create_repository,
277
289
self.assertFalse(repo.is_shared())
279
291
def test_create_repository_under_shared(self):
280
292
# an explicit create_repository always does so.
281
293
# we trust the format is right from the 'create_repository test'
294
# new interface is to make the bzrdir, then a repository within that.
282
295
format = bzrdir.format_registry.make_bzrdir('knit')
283
296
self.make_repository('.', shared=True, format=format)
284
repo = bzrdir.BzrDir.create_repository(self.get_url('child'),
297
repo = self.applyDeprecated(zero_ninetyone,
298
bzrdir.BzrDir.create_repository,
299
self.get_url('child'),
286
301
self.assertTrue(isinstance(repo, repository.Repository))
287
302
self.assertTrue(repo.bzrdir.root_transport.base.endswith('child/'))