177
177
dir.create_repository()
178
178
format.initialize(dir)
179
179
found_format = _mod_branch.BranchFormat.find_format(dir)
180
self.assertIsInstance(found_format, format.__class__)
180
self.failUnless(isinstance(found_format, format.__class__))
181
181
check_format(_mod_branch.BzrBranchFormat5(), "bar")
183
183
def test_find_format_factory(self):
323
323
def test_layout(self):
324
324
branch = self.make_branch('a', format=self.get_format_name())
325
self.assertPathExists('a/.bzr/branch/last-revision')
326
self.assertPathDoesNotExist('a/.bzr/branch/revision-history')
327
self.assertPathDoesNotExist('a/.bzr/branch/references')
325
self.failUnlessExists('a/.bzr/branch/last-revision')
326
self.failIfExists('a/.bzr/branch/revision-history')
327
self.failIfExists('a/.bzr/branch/references')
329
329
def test_config(self):
330
330
"""Ensure that all configuration data is stored in the branch"""
331
331
branch = self.make_branch('a', format=self.get_format_name())
332
332
branch.set_parent('http://example.com')
333
self.assertPathDoesNotExist('a/.bzr/branch/parent')
333
self.failIfExists('a/.bzr/branch/parent')
334
334
self.assertEqual('http://example.com', branch.get_parent())
335
335
branch.set_push_location('sftp://example.com')
336
336
config = branch.get_config()._get_branch_data_config()
337
337
self.assertEqual('sftp://example.com',
338
338
config.get_user_option('push_location'))
339
339
branch.set_bound_location('ftp://example.com')
340
self.assertPathDoesNotExist('a/.bzr/branch/bound')
340
self.failIfExists('a/.bzr/branch/bound')
341
341
self.assertEqual('ftp://example.com', branch.get_bound_location())
343
343
def test_set_revision_history(self):
349
349
branch = builder.get_branch()
350
350
branch.lock_write()
351
351
self.addCleanup(branch.unlock)
352
self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
353
branch.set_revision_history, ['foo', 'bar'])
354
self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
355
branch.set_revision_history, ['foo'])
352
branch.set_revision_history(['foo', 'bar'])
353
branch.set_revision_history(['foo'])
356
354
self.assertRaises(errors.NotLefthandHistory,
357
self.applyDeprecated, symbol_versioning.deprecated_in((2, 4, 0)),
358
branch.set_revision_history, ['bar'])
355
branch.set_revision_history, ['bar'])
360
357
def do_checkout_test(self, lightweight=False):
361
358
tree = self.make_branch_and_tree('source',
374
371
subtree.commit('a subtree file')
375
372
subsubtree.commit('a subsubtree file')
376
373
tree.branch.create_checkout('target', lightweight=lightweight)
377
self.assertPathExists('target')
378
self.assertPathExists('target/subtree')
379
self.assertPathExists('target/subtree/file')
380
self.assertPathExists('target/subtree/subsubtree/file')
374
self.failUnlessExists('target')
375
self.failUnlessExists('target/subtree')
376
self.failUnlessExists('target/subtree/file')
377
self.failUnlessExists('target/subtree/subsubtree/file')
381
378
subbranch = _mod_branch.Branch.open('target/subtree/subsubtree')
383
380
self.assertEndsWith(subbranch.base, 'source/subtree/subsubtree/')