190
190
format.set_branch_format(_mod_branch.BzrBranchFormat6())
191
191
branch = self.make_branch('a', format=format)
192
192
self.assertIsInstance(branch, _mod_branch.BzrBranch6)
193
branch = self.make_branch('b', format='experimental-branch6')
193
branch = self.make_branch('b', format='dirstate-with-subtree')
194
194
self.assertIsInstance(branch, _mod_branch.BzrBranch6)
195
195
branch = _mod_branch.Branch.open('a')
196
196
self.assertIsInstance(branch, _mod_branch.BzrBranch6)
198
198
def test_layout(self):
199
branch = self.make_branch('a', format='experimental-branch6')
199
branch = self.make_branch('a', format='dirstate-with-subtree')
200
200
self.failUnlessExists('a/.bzr/branch/last-revision')
201
201
self.failIfExists('a/.bzr/branch/revision-history')
203
203
def test_config(self):
204
204
"""Ensure that all configuration data is stored in the branch"""
205
branch = self.make_branch('a', format='experimental-branch6')
205
branch = self.make_branch('a', format='dirstate-with-subtree')
206
206
branch.set_parent('http://bazaar-vcs.org')
207
207
self.failIfExists('a/.bzr/branch/parent')
208
208
self.assertEqual('http://bazaar-vcs.org', branch.get_parent())
217
217
def test_set_revision_history(self):
218
218
tree = self.make_branch_and_memory_tree('.',
219
format='experimental-branch6')
219
format='dirstate-with-subtree')
220
220
tree.lock_write()
232
232
def test_append_revision(self):
233
233
tree = self.make_branch_and_tree('branch1',
234
format='experimental-branch6')
234
format='dirstate-with-subtree')
235
235
tree.lock_write()
238
237
tree.commit('foo', rev_id='foo')
239
238
tree.commit('bar', rev_id='bar')
240
239
tree.commit('baz', rev_id='baz')
258
def do_checkout_test(self, lightweight=False):
259
tree = self.make_branch_and_tree('source', format='dirstate-with-subtree')
260
subtree = self.make_branch_and_tree('source/subtree',
261
format='dirstate-with-subtree')
262
subsubtree = self.make_branch_and_tree('source/subtree/subsubtree',
263
format='dirstate-with-subtree')
264
self.build_tree(['source/subtree/file',
265
'source/subtree/subsubtree/file'])
266
subsubtree.add('file')
268
subtree.add_reference(subsubtree)
269
tree.add_reference(subtree)
270
tree.commit('a revision')
271
subtree.commit('a subtree file')
272
subsubtree.commit('a subsubtree file')
273
tree.branch.create_checkout('target', lightweight=lightweight)
274
self.failUnlessExists('target')
275
self.failUnlessExists('target/subtree')
276
self.failUnlessExists('target/subtree/file')
277
self.failUnlessExists('target/subtree/subsubtree/file')
278
subbranch = _mod_branch.Branch.open('target/subtree/subsubtree')
280
self.assertEndsWith(subbranch.base, 'source/subtree/subsubtree/')
282
self.assertEndsWith(subbranch.base, 'target/subtree/subsubtree/')
285
def test_checkout_with_references(self):
286
self.do_checkout_test()
288
def test_light_checkout_with_references(self):
289
self.do_checkout_test(lightweight=True)
260
291
class TestBranchReference(TestCaseWithTransport):
261
292
"""Tests for the branch reference facility."""