~bzr-pqm/bzr/bzr.dev

2255.7.83 by John Arbash Meinel
Update some obvious copyright headers to include 2007.
1
# Copyright (C) 2006, 2007 Canonical Ltd
1852.6.1 by Robert Collins
Start tree implementation tests.
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1852.6.1 by Robert Collins
Start tree implementation tests.
16
4523.1.4 by Martin Pool
Rename remaining *_implementations tests
17
"""Tests for the test trees used by the per_tree tests."""
1852.6.1 by Robert Collins
Start tree implementation tests.
18
4523.1.4 by Martin Pool
Rename remaining *_implementations tests
19
from bzrlib.tests import per_tree
5967.12.1 by Martin Pool
Move all test features into bzrlib.tests.features
20
from bzrlib.tests import (
21
    features,
22
    )
4523.1.4 by Martin Pool
Rename remaining *_implementations tests
23
24
25
class TestTreeShapes(per_tree.TestCaseWithTree):
1852.6.1 by Robert Collins
Start tree implementation tests.
26
27
    def test_empty_tree_no_parents(self):
1852.8.3 by Robert Collins
Implement an InterTreeTestProvider and a trivial test_compare test case.
28
        tree = self.make_branch_and_tree('.')
29
        tree = self.get_tree_no_parents_no_content(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
30
        tree.lock_read()
31
        self.addCleanup(tree.unlock)
1852.6.1 by Robert Collins
Start tree implementation tests.
32
        self.assertEqual([], tree.get_parent_ids())
33
        self.assertEqual([], tree.conflicts())
34
        self.assertEqual([], list(tree.unknowns()))
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
35
        self.assertEqual(['empty-root-id'], list(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
36
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
37
            [('', 'empty-root-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
38
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
39
40
    def test_abc_tree_no_parents(self):
1852.8.7 by Robert Collins
Update tree_implementation test tree factories to be intertree ready.
41
        tree = self.make_branch_and_tree('.')
42
        tree = self.get_tree_no_parents_abc_content(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
43
        tree.lock_read()
44
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
45
        self.assertEqual([], tree.get_parent_ids())
46
        self.assertEqual([], tree.conflicts())
47
        self.assertEqual([], list(tree.unknowns()))
48
        # __iter__ has no strongly defined order
49
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
50
            set(['root-id', 'a-id', 'b-id', 'c-id']),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
51
            set(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
52
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
53
            [('', 'root-id'), ('a', 'a-id'), ('b', 'b-id'), ('b/c', 'c-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
54
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
55
        self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id'))
3363.2.7 by Aaron Bentley
Implement alterntative-to-inventory tests
56
        self.assertFalse(tree.is_executable('c-id', path='b/c'))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
57
58
    def test_abc_tree_content_2_no_parents(self):
1852.8.7 by Robert Collins
Update tree_implementation test tree factories to be intertree ready.
59
        tree = self.make_branch_and_tree('.')
60
        tree = self.get_tree_no_parents_abc_content_2(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
61
        tree.lock_read()
62
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
63
        self.assertEqual([], tree.get_parent_ids())
64
        self.assertEqual([], tree.conflicts())
65
        self.assertEqual([], list(tree.unknowns()))
66
        # __iter__ has no strongly defined order
67
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
68
            set(['root-id', 'a-id', 'b-id', 'c-id']),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
69
            set(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
70
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
71
            [('', 'root-id'), ('a', 'a-id'), ('b', 'b-id'), ('b/c', 'c-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
72
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
73
        self.assertEqualDiff('foobar\n', tree.get_file_text('a-id'))
74
        self.assertFalse(tree.is_executable('c-id'))
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
75
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
76
    def test_abc_tree_content_3_no_parents(self):
1852.8.7 by Robert Collins
Update tree_implementation test tree factories to be intertree ready.
77
        tree = self.make_branch_and_tree('.')
78
        tree = self.get_tree_no_parents_abc_content_3(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
79
        tree.lock_read()
80
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
81
        self.assertEqual([], tree.get_parent_ids())
82
        self.assertEqual([], tree.conflicts())
83
        self.assertEqual([], list(tree.unknowns()))
84
        # __iter__ has no strongly defined order
85
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
86
            set(['root-id', 'a-id', 'b-id', 'c-id']),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
87
            set(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
88
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
89
            [('', 'root-id'), ('a', 'a-id'), ('b', 'b-id'), ('b/c', 'c-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
90
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
91
        self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id'))
92
        self.assertTrue(tree.is_executable('c-id'))
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
93
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
94
    def test_abc_tree_content_4_no_parents(self):
1852.8.7 by Robert Collins
Update tree_implementation test tree factories to be intertree ready.
95
        tree = self.make_branch_and_tree('.')
96
        tree = self.get_tree_no_parents_abc_content_4(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
97
        tree.lock_read()
98
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
99
        self.assertEqual([], tree.get_parent_ids())
100
        self.assertEqual([], tree.conflicts())
101
        self.assertEqual([], list(tree.unknowns()))
102
        # __iter__ has no strongly defined order
103
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
104
            set(['root-id', 'a-id', 'b-id', 'c-id']),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
105
            set(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
106
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
107
            [('', 'root-id'), ('b', 'b-id'), ('d', 'a-id'), ('b/c', 'c-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
108
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
109
        self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id'))
110
        self.assertFalse(tree.is_executable('c-id'))
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
111
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
112
    def test_abc_tree_content_5_no_parents(self):
1852.8.7 by Robert Collins
Update tree_implementation test tree factories to be intertree ready.
113
        tree = self.make_branch_and_tree('.')
114
        tree = self.get_tree_no_parents_abc_content_5(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
115
        tree.lock_read()
116
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
117
        self.assertEqual([], tree.get_parent_ids())
118
        self.assertEqual([], tree.conflicts())
119
        self.assertEqual([], list(tree.unknowns()))
120
        # __iter__ has no strongly defined order
121
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
122
            set(['root-id', 'a-id', 'b-id', 'c-id']),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
123
            set(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
124
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
125
            [('', 'root-id'), ('b', 'b-id'), ('d', 'a-id'), ('b/c', 'c-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
126
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
127
        self.assertEqualDiff('bar\n', tree.get_file_text('a-id'))
128
        self.assertFalse(tree.is_executable('c-id'))
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
129
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
130
    def test_abc_tree_content_6_no_parents(self):
1852.8.7 by Robert Collins
Update tree_implementation test tree factories to be intertree ready.
131
        tree = self.make_branch_and_tree('.')
132
        tree = self.get_tree_no_parents_abc_content_6(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
133
        tree.lock_read()
134
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
135
        self.assertEqual([], tree.get_parent_ids())
136
        self.assertEqual([], tree.conflicts())
137
        self.assertEqual([], list(tree.unknowns()))
138
        # __iter__ has no strongly defined order
139
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
140
            set(['root-id', 'a-id', 'b-id', 'c-id']),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
141
            set(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
142
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
143
            [('', 'root-id'), ('a', 'a-id'), ('b', 'b-id'), ('e', 'c-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
144
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
145
        self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id'))
146
        self.assertTrue(tree.is_executable('c-id'))
2294.1.1 by John Arbash Meinel
Track down some non-ascii deficiencies in commit logic.
147
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
148
    def test_tree_with_subdirs_and_all_content_types(self):
149
        # currently this test tree requires unicode. It might be good
150
        # to have it simply stop having the single unicode file in it
151
        # when dealing with a non-unicode filesystem.
5967.12.1 by Martin Pool
Move all test features into bzrlib.tests.features
152
        self.requireFeature(features.SymlinkFeature)
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
153
        tree = self.get_tree_with_subdirs_and_all_content_types()
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
154
        tree.lock_read()
155
        self.addCleanup(tree.unlock)
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
156
        self.assertEqual([], tree.get_parent_ids())
157
        self.assertEqual([], tree.conflicts())
158
        self.assertEqual([], list(tree.unknowns()))
159
        # __iter__ has no strongly defined order
2255.2.17 by Robert Collins
tweaks - finishes off all the test_test_trees tests for dirstate.
160
        tree_root = tree.path2id('')
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
161
        self.assertEqual(
2255.2.17 by Robert Collins
tweaks - finishes off all the test_test_trees tests for dirstate.
162
            set([tree_root,
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
163
                '2file',
164
                '1top-dir',
165
                '1file-in-1topdir',
166
                '0dir-in-1topdir',
2255.2.107 by John Arbash Meinel
(working), fix dirstate to use utf8 file ids.
167
                 u'0utf\u1234file'.encode('utf8'),
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
168
                'symlink',
169
                 ]),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
170
            set(tree.all_file_ids()))
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
171
        # note that the order of the paths and fileids is deliberately
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
172
        # mismatched to ensure that the result order is path based.
173
        self.assertEqual(
2255.2.17 by Robert Collins
tweaks - finishes off all the test_test_trees tests for dirstate.
174
            [('', tree_root, 'directory'),
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
175
             ('0file', '2file', 'file'),
176
             ('1top-dir', '1top-dir', 'directory'),
2255.2.107 by John Arbash Meinel
(working), fix dirstate to use utf8 file ids.
177
             (u'2utf\u1234file', u'0utf\u1234file'.encode('utf8'), 'file'),
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
178
             ('symlink', 'symlink', 'symlink'),
179
             ('1top-dir/0file-in-1topdir', '1file-in-1topdir', 'file'),
180
             ('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')],
181
            [(path, node.file_id, node.kind) for path, node in tree.iter_entries_by_dir()])
2255.2.106 by John Arbash Meinel
[merge] bzr.dev 2298 (broken)
182
2408.1.3 by Alexander Belchenko
tree_implementations: make usage of symlinks optional
183
    def test_tree_with_subdirs_and_all_content_types_wo_symlinks(self):
184
        # currently this test tree requires unicode. It might be good
185
        # to have it simply stop having the single unicode file in it
186
        # when dealing with a non-unicode filesystem.
187
        tree = self.get_tree_with_subdirs_and_all_supported_content_types(False)
188
        tree.lock_read()
189
        self.addCleanup(tree.unlock)
190
        self.assertEqual([], tree.get_parent_ids())
191
        self.assertEqual([], tree.conflicts())
192
        self.assertEqual([], list(tree.unknowns()))
193
        # __iter__ has no strongly defined order
194
        tree_root = tree.path2id('')
195
        self.assertEqual(
196
            set([tree_root,
197
                '2file',
198
                '1top-dir',
199
                '1file-in-1topdir',
200
                '0dir-in-1topdir',
201
                 u'0utf\u1234file'.encode('utf8'),
202
                 ]),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
203
            set(tree.all_file_ids()))
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
204
        # note that the order of the paths and fileids is deliberately
2408.1.3 by Alexander Belchenko
tree_implementations: make usage of symlinks optional
205
        # mismatched to ensure that the result order is path based.
206
        self.assertEqual(
207
            [('', tree_root, 'directory'),
208
             ('0file', '2file', 'file'),
209
             ('1top-dir', '1top-dir', 'directory'),
210
             (u'2utf\u1234file', u'0utf\u1234file'.encode('utf8'), 'file'),
211
             ('1top-dir/0file-in-1topdir', '1file-in-1topdir', 'file'),
212
             ('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')],
213
            [(path, node.file_id, node.kind) for path, node in tree.iter_entries_by_dir()])
214
2294.1.1 by John Arbash Meinel
Track down some non-ascii deficiencies in commit logic.
215
    def test_tree_with_utf8(self):
216
        tree = self.make_branch_and_tree('.')
217
        tree = self.get_tree_with_utf8(tree)
2294.1.2 by John Arbash Meinel
Track down and add tests that all tree.commit() can handle
218
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
219
        revision_id = u'r\xe9v-1'.encode('utf8')
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
220
        root_id = 'TREE_ROOT'
3638.3.12 by Vincent Ladeuil
Fix test missed in the previous commit (--starting-with doesn't
221
        bar_id = u'ba\N{Euro Sign}r-id'.encode('utf8')
222
        foo_id = u'fo\N{Euro Sign}o-id'.encode('utf8')
223
        baz_id = u'ba\N{Euro Sign}z-id'.encode('utf8')
224
        path_and_ids = [(u'', root_id, None, None),
225
                        (u'ba\N{Euro Sign}r', bar_id, root_id, revision_id),
226
                        (u'fo\N{Euro Sign}o', foo_id, root_id, revision_id),
227
                        (u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',
228
                         baz_id, bar_id, revision_id),
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
229
                       ]
230
        tree.lock_read()
231
        try:
232
            path_entries = list(tree.iter_entries_by_dir())
233
        finally:
234
            tree.unlock()
235
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
236
        for expected, (path, ie) in zip(path_and_ids, path_entries):
237
            self.assertEqual(expected[0], path) # Paths should match
238
            self.assertIsInstance(path, unicode)
239
            self.assertEqual(expected[1], ie.file_id)
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
240
            self.assertIsInstance(ie.file_id, str)
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
241
            self.assertEqual(expected[2], ie.parent_id)
242
            if expected[2] is not None:
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
243
                self.assertIsInstance(ie.parent_id, str)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
244
            # WorkingTree's return None for the last modified revision
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
245
            if ie.revision is not None:
246
                self.assertIsInstance(ie.revision, str)
247
                if expected[0] != '':
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
248
                    # Some trees will preserve the revision id of the tree root,
249
                    # but not all will
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
250
                    self.assertEqual(revision_id, ie.revision)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
251
        self.assertEqual(len(path_and_ids), len(path_entries))
252
        get_revision_id = getattr(tree, 'get_revision_id', None)
253
        if get_revision_id is not None:
254
            self.assertIsInstance(get_revision_id(), str)
255
        last_revision = getattr(tree, 'last_revision', None)
256
        if last_revision is not None:
257
            self.assertIsInstance(last_revision(), str)
258
2294.1.2 by John Arbash Meinel
Track down and add tests that all tree.commit() can handle
259
    def test_tree_with_merged_utf8(self):
260
        tree = self.make_branch_and_tree('.')
261
        tree = self.get_tree_with_merged_utf8(tree)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
262
263
        revision_id_1 = u'r\xe9v-1'.encode('utf8')
264
        revision_id_2 = u'r\xe9v-2'.encode('utf8')
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
265
        root_id = 'TREE_ROOT'
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
266
        bar_id = u'ba\N{Euro Sign}r-id'.encode('utf8')
267
        foo_id = u'fo\N{Euro Sign}o-id'.encode('utf8')
268
        baz_id = u'ba\N{Euro Sign}z-id'.encode('utf8')
269
        qux_id = u'qu\N{Euro Sign}x-id'.encode('utf8')
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
270
        path_and_ids = [(u'', root_id, None, None),
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
271
                        (u'ba\N{Euro Sign}r', bar_id, root_id, revision_id_1),
272
                        (u'fo\N{Euro Sign}o', foo_id, root_id, revision_id_1),
273
                        (u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',
274
                         baz_id, bar_id, revision_id_1),
275
                        (u'ba\N{Euro Sign}r/qu\N{Euro Sign}x',
276
                         qux_id, bar_id, revision_id_2),
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
277
                       ]
278
        tree.lock_read()
279
        try:
280
            path_entries = list(tree.iter_entries_by_dir())
281
        finally:
282
            tree.unlock()
283
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
284
        for (epath, efid, eparent, erev), (path, ie) in zip(path_and_ids,
285
                                                            path_entries):
286
            self.assertEqual(epath, path) # Paths should match
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
287
            self.assertIsInstance(path, unicode)
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
288
            self.assertEqual(efid, ie.file_id)
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
289
            self.assertIsInstance(ie.file_id, str)
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
290
            self.assertEqual(eparent, ie.parent_id)
291
            if eparent is not None:
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
292
                self.assertIsInstance(ie.parent_id, str)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
293
            # WorkingTree's return None for the last modified revision
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
294
            if ie.revision is not None:
295
                self.assertIsInstance(ie.revision, str)
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
296
                if epath == '':
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
297
                    # Some trees will preserve the revision id of the tree root,
298
                    # but not all will
299
                    continue
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
300
                self.assertEqual(erev, ie.revision)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
301
        self.assertEqual(len(path_and_ids), len(path_entries))
302
        get_revision_id = getattr(tree, 'get_revision_id', None)
303
        if get_revision_id is not None:
304
            self.assertIsInstance(get_revision_id(), str)
305
        last_revision = getattr(tree, 'last_revision', None)
306
        if last_revision is not None:
307
            self.assertIsInstance(last_revision(), str)