/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/tree_implementations/test_tree.py

Most of the integration of dirstate and subtree

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
    def create_nested(self):
42
42
        work_tree = self.make_branch_and_tree('wt')
43
 
        self.skip_if_no_reference(work_tree)
44
 
        subtree = self.make_branch_and_tree('wt/subtree')
45
 
        subtree.set_root_id('sub-root')
46
 
        subtree.commit('foo', rev_id='sub-1')
47
 
        work_tree.add_reference(subtree)
 
43
        work_tree.lock_write()
 
44
        try:
 
45
            self.skip_if_no_reference(work_tree)
 
46
            subtree = self.make_branch_and_tree('wt/subtree')
 
47
            subtree.set_root_id('sub-root')
 
48
            subtree.commit('foo', rev_id='sub-1')
 
49
            work_tree.add_reference(subtree)
 
50
        finally:
 
51
            work_tree.unlock()
48
52
        tree = self._convert_tree(work_tree)
49
53
        self.skip_if_no_reference(tree)
50
54
        return tree
51
55
 
52
56
    def test_get_reference_revision(self):
53
57
        tree = self.create_nested()
54
 
        entry = tree.inventory['sub-root']
 
58
        tree.lock_read()
 
59
        try:
 
60
            entry = tree.inventory['sub-root']
 
61
        finally:
 
62
            tree.unlock()
55
63
        path = tree.id2path('sub-root')
56
64
        self.assertEqual('sub-1', tree.get_reference_revision(entry, path))
57
65
 
58
66
    def test_iter_reference_entries(self):
59
67
        tree = self.create_nested()
60
 
        entry = tree.inventory['sub-root']
 
68
        tree.lock_read()
 
69
        try:
 
70
            entry = tree.inventory['sub-root']
 
71
        finally:
 
72
            tree.unlock()
61
73
        self.assertEqual([entry], [e for p, e in
62
74
                                   tree.iter_reference_entries()])