55
56
class TestDefaultFormat(TestCase):
58
def test_default_format(self):
59
# update this if you change the default branch format
60
self.assertIsInstance(BranchFormat.get_default_format(),
63
def test_default_format_is_same_as_bzrdir_default(self):
64
# XXX: it might be nice if there was only one place the default was
65
# set, but at the moment that's not true -- mbp 20070814 --
66
# https://bugs.launchpad.net/bzr/+bug/132376
67
self.assertEqual(BranchFormat.get_default_format(),
68
BzrDirFormat.get_default_format().get_branch_format())
57
70
def test_get_set_default_format(self):
71
# set the format and then set it back again
58
72
old_format = BranchFormat.get_default_format()
60
self.assertTrue(isinstance(old_format, BzrBranchFormat5))
61
73
BranchFormat.set_default_format(SampleBranchFormat())
63
75
# the default branch format is used by the meta dir format
227
def test_append_revision(self):
228
tree = self.make_branch_and_tree('branch1',
229
format='dirstate-tags')
232
tree.commit('foo', rev_id='foo')
233
tree.commit('bar', rev_id='bar')
234
tree.commit('baz', rev_id='baz')
235
tree.set_last_revision('bar')
236
tree.branch.set_last_revision_info(2, 'bar')
237
tree.commit('qux', rev_id='qux')
238
tree.add_parent_tree_id('baz')
239
tree.commit('qux', rev_id='quxx')
240
tree.branch.set_last_revision_info(0, 'null:')
241
self.assertRaises(errors.NotLeftParentDescendant,
242
tree.branch.append_revision, 'bar')
243
tree.branch.append_revision('foo')
244
self.assertRaises(errors.NotLeftParentDescendant,
245
tree.branch.append_revision, 'baz')
246
tree.branch.append_revision('bar')
247
tree.branch.append_revision('baz')
248
self.assertRaises(errors.NotLeftParentDescendant,
249
tree.branch.append_revision, 'quxx')
253
239
def do_checkout_test(self, lightweight=False):
254
240
tree = self.make_branch_and_tree('source', format='dirstate-with-subtree')
255
241
subtree = self.make_branch_and_tree('source/subtree',