/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 breezy/tests/per_workingtree/test_add_reference.py

  • Committer: Jelmer Vernooij
  • Date: 2018-10-29 11:27:33 UTC
  • mto: This revision was merged to the branch mainline in revision 7170.
  • Revision ID: jelmer@jelmer.uk-20181029112733-bjvm24z12svwl53m
Get rid of file_ids in most of Tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
    def test_add_reference(self):
51
51
        tree, sub_tree = self.make_nested_trees()
52
52
        sub_tree_root_id = sub_tree.get_root_id()
53
 
        tree.lock_write()
54
 
        try:
 
53
        with tree.lock_write():
55
54
            if tree.supports_setting_file_ids():
56
55
                self.assertEqual(tree.path2id('sub-tree'), sub_tree_root_id)
57
56
            self.assertEqual(tree.kind('sub-tree'), 'tree-reference')
58
57
            tree.commit('commit reference')
59
58
            basis = tree.basis_tree()
60
 
            basis.lock_read()
61
 
            try:
62
 
                sub_tree = tree.get_nested_tree('sub-tree', sub_tree_root_id)
 
59
            with basis.lock_read():
 
60
                sub_tree = tree.get_nested_tree('sub-tree')
63
61
                self.assertEqual(
64
62
                        sub_tree.last_revision(),
65
 
                        tree.get_reference_revision('sub-tree', sub_tree_root_id))
66
 
            finally:
67
 
                basis.unlock()
68
 
        finally:
69
 
            tree.unlock()
 
63
                        tree.get_reference_revision('sub-tree'))
70
64
 
71
65
    def test_add_reference_same_root(self):
72
66
        tree = self.make_branch_and_tree('tree')
108
102
    def test_get_nested_tree(self):
109
103
        tree, sub_tree = self.make_nested_trees()
110
104
        sub_tree_root_id = sub_tree.get_root_id()
111
 
        tree.lock_read()
112
 
        try:
113
 
            sub_tree2 = tree.get_nested_tree('sub-tree', sub_tree_root_id)
114
 
            self.assertEqual(sub_tree.basedir, sub_tree2.basedir)
 
105
        with tree.lock_read():
115
106
            sub_tree2 = tree.get_nested_tree('sub-tree')
116
107
            self.assertEqual(sub_tree.basedir, sub_tree2.basedir)
117
 
        finally:
118
 
            tree.unlock()