138
141
'Directory formats')
139
142
topic = topics.get_detail('formats')
140
143
new, deprecated = topic.split('Deprecated formats')
141
self.assertContainsRe(new, 'Bazaar directory formats')
144
self.assertContainsRe(new, 'These formats can be used')
142
145
self.assertContainsRe(new,
143
' knit/default:\n \(native\) Format using knits\n')
146
':knit:\n \(native\) \(default\) Format using knits\n')
144
147
self.assertContainsRe(deprecated,
145
' lazy:\n \(native\) Format registered lazily\n')
148
':lazy:\n \(native\) Format registered lazily\n')
146
149
self.assertNotContainsRe(new, 'hidden')
148
151
def test_set_default_repository(self):
198
201
"""See BzrDirFormat.get_format_string()."""
199
202
return "Sample .bzr dir format."
201
def initialize(self, url):
204
def initialize(self, url, possible_transports=None):
202
205
"""Create a bzr dir."""
203
t = get_transport(url)
206
t = get_transport(url, possible_transports)
205
208
t.put_bytes('.bzr/branch-format', self.get_format_string())
206
209
return SampleBzrDir(t, self)
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/'))
289
304
def test_create_branch_and_repo_uses_default(self):
290
305
format = SampleBzrDirFormat()
291
branch = bzrdir.BzrDir.create_branch_and_repo(self.get_url(),
306
branch = bzrdir.BzrDir.create_branch_and_repo(self.get_url(),
293
308
self.assertTrue(isinstance(branch, SampleBranch))
343
358
branch.bzrdir.open_workingtree()
344
359
branch.bzrdir.open_repository()
361
def test_create_branch_convenience_possible_transports(self):
362
"""Check that the optional 'possible_transports' is recognized"""
363
format = bzrdir.format_registry.make_bzrdir('knit')
364
t = self.get_transport()
365
branch = bzrdir.BzrDir.create_branch_convenience(
366
'.', format=format, possible_transports=[t])
367
branch.bzrdir.open_workingtree()
368
branch.bzrdir.open_repository()
346
370
def test_create_branch_convenience_root(self):
347
371
"""Creating a branch at the root of a fs should work."""
348
372
self.vfs_transport_factory = MemoryServer