/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/repository_implementations/test_commit_builder.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from bzrlib import inventory
20
20
from bzrlib.errors import UnsupportedOperation
21
21
from bzrlib.repository import CommitBuilder
 
22
from bzrlib import tests
22
23
from bzrlib.tests.repository_implementations.test_repository import TestCaseWithRepository
23
24
 
24
25
 
33
34
        if builder.record_root_entry is True:
34
35
            ie = tree.inventory.root
35
36
            parent_tree = tree.branch.repository.revision_tree(None)
36
 
            parent_invs = [parent_tree.inventory]
 
37
            parent_invs = []
37
38
            builder.record_entry_contents(ie, parent_invs, '', tree)
38
39
 
39
40
    def test_finish_inventory(self):
70
71
    def test_commit_without_root(self):
71
72
        """This should cause a deprecation warning, not an assertion failure"""
72
73
        tree = self.make_branch_and_tree(".")
 
74
        if tree.branch.repository._format.rich_root_data:
 
75
            raise tests.TestSkipped('Format requires root')
73
76
        self.build_tree(['foo'])
74
77
        tree.add('foo', 'foo-id')
75
78
        entry = tree.inventory['foo-id']
92
95
        # precisely test that - a repository that wants to can add it on deserialisation,
93
96
        # but thats all the current contract guarantees anyway.
94
97
        self.assertEqual(rev_id, tree.branch.repository.get_inventory(rev_id).revision_id)
 
98
 
 
99
    def test_revision_tree(self):
 
100
        tree = self.make_branch_and_tree(".")
 
101
        builder = tree.branch.get_commit_builder([])
 
102
        self.record_root(builder, tree)
 
103
        builder.finish_inventory()
 
104
        rev_id = builder.commit('foo bar')
 
105
        rev_tree = builder.revision_tree()
 
106
        # Just a couple simple tests to ensure that it actually follows
 
107
        # the RevisionTree api.
 
108
        self.assertEqual(rev_id, rev_tree.get_revision_id())
 
109
        self.assertEqual([], rev_tree.get_parent_ids())