/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
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
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
19
from breezy.tests import per_tree
20
from breezy.tests import (
6861.1.1 by Jelmer Vernooij
More foreign branch test fixes.
21
    TestNotApplicable,
5967.12.1 by Martin Pool
Move all test features into bzrlib.tests.features
22
    features,
23
    )
4523.1.4 by Martin Pool
Rename remaining *_implementations tests
24
25
26
class TestTreeShapes(per_tree.TestCaseWithTree):
1852.6.1 by Robert Collins
Start tree implementation tests.
27
28
    def test_empty_tree_no_parents(self):
1852.8.3 by Robert Collins
Implement an InterTreeTestProvider and a trivial test_compare test case.
29
        tree = self.make_branch_and_tree('.')
30
        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'
31
        tree.lock_read()
32
        self.addCleanup(tree.unlock)
1852.6.1 by Robert Collins
Start tree implementation tests.
33
        self.assertEqual([], tree.get_parent_ids())
34
        self.assertEqual([], tree.conflicts())
35
        self.assertEqual([], list(tree.unknowns()))
6825.5.1 by Jelmer Vernooij
Implement Tree.all_versioned_paths.
36
        self.assertEqual([''], list(tree.all_versioned_paths()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
37
        self.assertEqual(
6844.1.1 by Jelmer Vernooij
Many more foreign branch fixes.
38
            [('', tree.path2id(''))],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
39
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
40
41
    def test_abc_tree_no_parents(self):
1852.8.7 by Robert Collins
Update tree_implementation test tree factories to be intertree ready.
42
        tree = self.make_branch_and_tree('.')
43
        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'
44
        tree.lock_read()
45
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
46
        self.assertEqual([], tree.get_parent_ids())
47
        self.assertEqual([], tree.conflicts())
48
        self.assertEqual([], list(tree.unknowns()))
49
        # __iter__ has no strongly defined order
50
        self.assertEqual(
6825.5.1 by Jelmer Vernooij
Implement Tree.all_versioned_paths.
51
            {'', 'a', 'b', 'b/c'},
52
            set(tree.all_versioned_paths()))
6852.3.1 by Jelmer Vernooij
add Tree.is_versioned.
53
        self.assertTrue(tree.is_versioned('a'))
54
        self.assertTrue(tree.is_versioned('b'))
55
        self.assertTrue(tree.is_versioned('b/c'))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
56
        self.assertEqual(
6793.5.1 by Jelmer Vernooij
Hardcode fileids in fewer places.
57
            [(p, tree.path2id(p)) for p in ['', 'a', 'b', 'b/c']],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
58
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
6809.4.5 by Jelmer Vernooij
Swap arguments for get_file_*.
59
        self.assertEqualDiff('contents of a\n', tree.get_file_text('a'))
6809.4.4 by Jelmer Vernooij
Swap arguments for Tree.is_executable.
60
        self.assertFalse(tree.is_executable('b/c'))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
61
62
    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.
63
        tree = self.make_branch_and_tree('.')
64
        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'
65
        tree.lock_read()
66
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
67
        self.assertEqual([], tree.get_parent_ids())
68
        self.assertEqual([], tree.conflicts())
69
        self.assertEqual([], list(tree.unknowns()))
70
        # __iter__ has no strongly defined order
71
        self.assertEqual(
6825.5.1 by Jelmer Vernooij
Implement Tree.all_versioned_paths.
72
            {'', 'a', 'b', 'b/c'},
73
            set(tree.all_versioned_paths()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
74
        self.assertEqual(
6793.5.1 by Jelmer Vernooij
Hardcode fileids in fewer places.
75
            [(p, tree.path2id(p)) for p in ['', 'a', 'b', 'b/c']],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
76
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
6809.4.5 by Jelmer Vernooij
Swap arguments for get_file_*.
77
        self.assertEqualDiff('foobar\n', tree.get_file_text('a'))
6809.4.4 by Jelmer Vernooij
Swap arguments for Tree.is_executable.
78
        self.assertFalse(tree.is_executable('b//c'))
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
79
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
80
    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.
81
        tree = self.make_branch_and_tree('.')
82
        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'
83
        tree.lock_read()
84
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
85
        self.assertEqual([], tree.get_parent_ids())
86
        self.assertEqual([], tree.conflicts())
87
        self.assertEqual([], list(tree.unknowns()))
88
        # __iter__ has no strongly defined order
89
        self.assertEqual(
6825.5.1 by Jelmer Vernooij
Implement Tree.all_versioned_paths.
90
            {'', 'a', 'b', 'b/c'},
91
            set(tree.all_versioned_paths()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
92
        self.assertEqual(
6793.5.1 by Jelmer Vernooij
Hardcode fileids in fewer places.
93
            [(p, tree.path2id(p)) for p in ['', 'a', 'b', 'b/c']],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
94
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
6809.4.5 by Jelmer Vernooij
Swap arguments for get_file_*.
95
        self.assertEqualDiff('contents of a\n', tree.get_file_text('a'))
6809.4.4 by Jelmer Vernooij
Swap arguments for Tree.is_executable.
96
        self.assertTrue(tree.is_executable('b/c'))
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
97
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
98
    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.
99
        tree = self.make_branch_and_tree('.')
100
        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'
101
        tree.lock_read()
102
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
103
        self.assertEqual([], tree.get_parent_ids())
104
        self.assertEqual([], tree.conflicts())
105
        self.assertEqual([], list(tree.unknowns()))
106
        # __iter__ has no strongly defined order
107
        self.assertEqual(
6825.5.1 by Jelmer Vernooij
Implement Tree.all_versioned_paths.
108
            {'', 'b', 'd', 'b/c'},
109
            set(tree.all_versioned_paths()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
110
        self.assertEqual(
6793.5.1 by Jelmer Vernooij
Hardcode fileids in fewer places.
111
            [(p, tree.path2id(p)) for p in ['', 'b', 'd', 'b/c']],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
112
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
6809.4.5 by Jelmer Vernooij
Swap arguments for get_file_*.
113
        self.assertEqualDiff('contents of a\n', tree.get_file_text('d'))
6809.4.4 by Jelmer Vernooij
Swap arguments for Tree.is_executable.
114
        self.assertFalse(tree.is_executable('b/c'))
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
115
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
116
    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.
117
        tree = self.make_branch_and_tree('.')
118
        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'
119
        tree.lock_read()
120
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
121
        self.assertEqual([], tree.get_parent_ids())
122
        self.assertEqual([], tree.conflicts())
123
        self.assertEqual([], list(tree.unknowns()))
124
        # __iter__ has no strongly defined order
125
        self.assertEqual(
6825.5.1 by Jelmer Vernooij
Implement Tree.all_versioned_paths.
126
            {'', 'd', 'b', 'b/c'},
127
            set(tree.all_versioned_paths()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
128
        self.assertEqual(
6793.5.1 by Jelmer Vernooij
Hardcode fileids in fewer places.
129
            [(p, tree.path2id(p)) for p in ['', 'b', 'd',  'b/c']],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
130
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
6809.4.5 by Jelmer Vernooij
Swap arguments for get_file_*.
131
        self.assertEqualDiff('bar\n', tree.get_file_text('d'))
6809.4.4 by Jelmer Vernooij
Swap arguments for Tree.is_executable.
132
        self.assertFalse(tree.is_executable('b/c'))
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
133
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
134
    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.
135
        tree = self.make_branch_and_tree('.')
136
        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'
137
        tree.lock_read()
138
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
139
        self.assertEqual([], tree.get_parent_ids())
140
        self.assertEqual([], tree.conflicts())
141
        self.assertEqual([], list(tree.unknowns()))
142
        # __iter__ has no strongly defined order
6844.1.1 by Jelmer Vernooij
Many more foreign branch fixes.
143
        expected_paths = (
144
                ['', 'a'] +
145
                (['b'] if tree.has_versioned_directories() else []) +
146
                ['e'])
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
147
        self.assertEqual(
6844.1.1 by Jelmer Vernooij
Many more foreign branch fixes.
148
            set(expected_paths),
6825.5.1 by Jelmer Vernooij
Implement Tree.all_versioned_paths.
149
            set(tree.all_versioned_paths()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
150
        self.assertEqual(
6844.1.1 by Jelmer Vernooij
Many more foreign branch fixes.
151
            [(p, tree.path2id(p)) for p in expected_paths],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
152
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
6809.4.5 by Jelmer Vernooij
Swap arguments for get_file_*.
153
        self.assertEqualDiff('contents of a\n', tree.get_file_text('a'))
6809.4.4 by Jelmer Vernooij
Swap arguments for Tree.is_executable.
154
        self.assertTrue(tree.is_executable('e'))
2294.1.1 by John Arbash Meinel
Track down some non-ascii deficiencies in commit logic.
155
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
156
    def test_tree_with_subdirs_and_all_content_types(self):
157
        # currently this test tree requires unicode. It might be good
158
        # to have it simply stop having the single unicode file in it
159
        # when dealing with a non-unicode filesystem.
5967.12.1 by Martin Pool
Move all test features into bzrlib.tests.features
160
        self.requireFeature(features.SymlinkFeature)
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
161
        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'
162
        tree.lock_read()
163
        self.addCleanup(tree.unlock)
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
164
        self.assertEqual([], tree.get_parent_ids())
165
        self.assertEqual([], tree.conflicts())
166
        self.assertEqual([], list(tree.unknowns()))
167
        # __iter__ has no strongly defined order
2255.2.17 by Robert Collins
tweaks - finishes off all the test_test_trees tests for dirstate.
168
        tree_root = tree.path2id('')
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
169
        self.assertEqual(
6851.1.1 by Jelmer Vernooij
More foreign branch fixes.
170
            {tree.path2id(p) for p in [
171
                '', '0file', '1top-dir', '1top-dir/1dir-in-1topdir',
172
                '1top-dir/0file-in-1topdir', 'symlink', u'2utf\u1234file']},
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
173
            set(tree.all_file_ids()))
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
174
        # 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.
175
        # mismatched to ensure that the result order is path based.
176
        self.assertEqual(
6851.1.1 by Jelmer Vernooij
More foreign branch fixes.
177
            [('', 'directory'),
178
             ('0file', 'file'),
179
             ('1top-dir', 'directory'),
180
             (u'2utf\u1234file', 'file'),
181
             ('symlink', 'symlink'),
182
             ('1top-dir/0file-in-1topdir', 'file'),
183
             ('1top-dir/1dir-in-1topdir', 'directory')],
184
            [(path, node.kind) for path, node in tree.iter_entries_by_dir()])
2255.2.106 by John Arbash Meinel
[merge] bzr.dev 2298 (broken)
185
2408.1.3 by Alexander Belchenko
tree_implementations: make usage of symlinks optional
186
    def test_tree_with_subdirs_and_all_content_types_wo_symlinks(self):
187
        # currently this test tree requires unicode. It might be good
188
        # to have it simply stop having the single unicode file in it
189
        # when dealing with a non-unicode filesystem.
190
        tree = self.get_tree_with_subdirs_and_all_supported_content_types(False)
191
        tree.lock_read()
192
        self.addCleanup(tree.unlock)
193
        self.assertEqual([], tree.get_parent_ids())
194
        self.assertEqual([], tree.conflicts())
195
        self.assertEqual([], list(tree.unknowns()))
196
        # __iter__ has no strongly defined order
197
        tree_root = tree.path2id('')
198
        self.assertEqual(
6851.1.1 by Jelmer Vernooij
More foreign branch fixes.
199
            {'', '0file', '1top-dir', '1top-dir/0file-in-1topdir',
200
             '1top-dir/1dir-in-1topdir', u'2utf\u1234file'},
201
            set(tree.all_versioned_paths()))
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
202
        # note that the order of the paths and fileids is deliberately
2408.1.3 by Alexander Belchenko
tree_implementations: make usage of symlinks optional
203
        # mismatched to ensure that the result order is path based.
204
        self.assertEqual(
6851.1.1 by Jelmer Vernooij
More foreign branch fixes.
205
            [('', 'directory'),
206
             ('0file', 'file'),
207
             ('1top-dir', 'directory'),
208
             (u'2utf\u1234file', 'file'),
209
             ('1top-dir/0file-in-1topdir', 'file'),
210
             ('1top-dir/1dir-in-1topdir', 'directory')],
211
            [(path, node.kind) for path, node in tree.iter_entries_by_dir()])
2408.1.3 by Alexander Belchenko
tree_implementations: make usage of symlinks optional
212
2294.1.1 by John Arbash Meinel
Track down some non-ascii deficiencies in commit logic.
213
    def test_tree_with_utf8(self):
214
        tree = self.make_branch_and_tree('.')
6861.1.2 by Jelmer Vernooij
Fix test.
215
        if not tree.supports_setting_file_ids():
6861.1.1 by Jelmer Vernooij
More foreign branch test fixes.
216
            raise TestNotApplicable(
217
                'format does not support custom file ids')
2294.1.1 by John Arbash Meinel
Track down some non-ascii deficiencies in commit logic.
218
        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
219
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
220
        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
221
        root_id = 'TREE_ROOT'
3638.3.12 by Vincent Ladeuil
Fix test missed in the previous commit (--starting-with doesn't
222
        bar_id = u'ba\N{Euro Sign}r-id'.encode('utf8')
223
        foo_id = u'fo\N{Euro Sign}o-id'.encode('utf8')
224
        baz_id = u'ba\N{Euro Sign}z-id'.encode('utf8')
225
        path_and_ids = [(u'', root_id, None, None),
226
                        (u'ba\N{Euro Sign}r', bar_id, root_id, revision_id),
227
                        (u'fo\N{Euro Sign}o', foo_id, root_id, revision_id),
228
                        (u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',
229
                         baz_id, bar_id, revision_id),
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
230
                       ]
231
        tree.lock_read()
232
        try:
233
            path_entries = list(tree.iter_entries_by_dir())
234
        finally:
235
            tree.unlock()
236
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
237
        for expected, (path, ie) in zip(path_and_ids, path_entries):
238
            self.assertEqual(expected[0], path) # Paths should match
239
            self.assertIsInstance(path, unicode)
240
            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
241
            self.assertIsInstance(ie.file_id, str)
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
242
            self.assertEqual(expected[2], ie.parent_id)
243
            if expected[2] is not None:
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
244
                self.assertIsInstance(ie.parent_id, str)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
245
            # 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
246
            if ie.revision is not None:
247
                self.assertIsInstance(ie.revision, str)
248
                if expected[0] != '':
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
249
                    # Some trees will preserve the revision id of the tree root,
250
                    # but not all will
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
251
                    self.assertEqual(revision_id, ie.revision)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
252
        self.assertEqual(len(path_and_ids), len(path_entries))
253
        get_revision_id = getattr(tree, 'get_revision_id', None)
254
        if get_revision_id is not None:
255
            self.assertIsInstance(get_revision_id(), str)
256
        last_revision = getattr(tree, 'last_revision', None)
257
        if last_revision is not None:
258
            self.assertIsInstance(last_revision(), str)
259
2294.1.2 by John Arbash Meinel
Track down and add tests that all tree.commit() can handle
260
    def test_tree_with_merged_utf8(self):
261
        tree = self.make_branch_and_tree('.')
262
        tree = self.get_tree_with_merged_utf8(tree)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
263
264
        revision_id_1 = u'r\xe9v-1'.encode('utf8')
265
        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
266
        root_id = 'TREE_ROOT'
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
267
        bar_id = u'ba\N{Euro Sign}r-id'.encode('utf8')
268
        foo_id = u'fo\N{Euro Sign}o-id'.encode('utf8')
269
        baz_id = u'ba\N{Euro Sign}z-id'.encode('utf8')
270
        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
271
        path_and_ids = [(u'', root_id, None, None),
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
272
                        (u'ba\N{Euro Sign}r', bar_id, root_id, revision_id_1),
273
                        (u'fo\N{Euro Sign}o', foo_id, root_id, revision_id_1),
274
                        (u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',
275
                         baz_id, bar_id, revision_id_1),
276
                        (u'ba\N{Euro Sign}r/qu\N{Euro Sign}x',
277
                         qux_id, bar_id, revision_id_2),
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
278
                       ]
279
        tree.lock_read()
280
        try:
281
            path_entries = list(tree.iter_entries_by_dir())
282
        finally:
283
            tree.unlock()
284
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
285
        for (epath, efid, eparent, erev), (path, ie) in zip(path_and_ids,
286
                                                            path_entries):
287
            self.assertEqual(epath, path) # Paths should match
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
288
            self.assertIsInstance(path, unicode)
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
289
            self.assertEqual(efid, ie.file_id)
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
290
            self.assertIsInstance(ie.file_id, str)
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
291
            self.assertEqual(eparent, ie.parent_id)
292
            if eparent is not None:
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
293
                self.assertIsInstance(ie.parent_id, str)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
294
            # 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
295
            if ie.revision is not None:
296
                self.assertIsInstance(ie.revision, str)
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
297
                if epath == '':
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
298
                    # Some trees will preserve the revision id of the tree root,
299
                    # but not all will
300
                    continue
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
301
                self.assertEqual(erev, ie.revision)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
302
        self.assertEqual(len(path_and_ids), len(path_entries))
303
        get_revision_id = getattr(tree, 'get_revision_id', None)
304
        if get_revision_id is not None:
305
            self.assertIsInstance(get_revision_id(), str)
306
        last_revision = getattr(tree, 'last_revision', None)
307
        if last_revision is not None:
308
            self.assertIsInstance(last_revision(), str)