~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-08-17 10:41:28 UTC
  • mfrom: (2696.3.10 default-format)
  • Revision ID: pqm@pqm.ubuntu.com-20070817104128-30oe09d0jeoii7fx
(mbp) Set default forrmat to dirstate-tags

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    BranchReferenceFormat,
40
40
    BzrBranch5,
41
41
    BzrBranchFormat5,
 
42
    BzrBranchFormat6,
42
43
    PullResult,
43
44
    )
44
45
from bzrlib.bzrdir import (BzrDirMetaFormat1, BzrDirMeta1, 
54
55
 
55
56
class TestDefaultFormat(TestCase):
56
57
 
 
58
    def test_default_format(self):
 
59
        # update this if you change the default branch format
 
60
        self.assertIsInstance(BranchFormat.get_default_format(),
 
61
                BzrBranchFormat6)
 
62
 
 
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())
 
69
 
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()
59
 
        # default is 5
60
 
        self.assertTrue(isinstance(old_format, BzrBranchFormat5))
61
73
        BranchFormat.set_default_format(SampleBranchFormat())
62
74
        try:
63
75
            # the default branch format is used by the meta dir format
224
236
        finally:
225
237
            tree.unlock()
226
238
 
227
 
    def test_append_revision(self):
228
 
        tree = self.make_branch_and_tree('branch1',
229
 
            format='dirstate-tags')
230
 
        tree.lock_write()
231
 
        try:
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')
250
 
        finally:
251
 
            tree.unlock()
252
 
 
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',
276
262
        else:
277
263
            self.assertEndsWith(subbranch.base, 'target/subtree/subsubtree/')
278
264
 
279
 
 
280
265
    def test_checkout_with_references(self):
281
266
        self.do_checkout_test()
282
267