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
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
17 |
"""Tests for the test trees used by the tree_implementations tests."""
|
|
18 |
||
2949.5.1
by Alexander Belchenko
selftest: use SymlinkFeature instead of TestSkipped where appropriate |
19 |
from bzrlib.tests import SymlinkFeature |
1852.6.1
by Robert Collins
Start tree implementation tests. |
20 |
from bzrlib.tests.tree_implementations import TestCaseWithTree |
21 |
||
22 |
||
23 |
class TestTreeShapes(TestCaseWithTree): |
|
24 |
||
25 |
def test_empty_tree_no_parents(self): |
|
1852.8.3
by Robert Collins
Implement an InterTreeTestProvider and a trivial test_compare test case. |
26 |
tree = self.make_branch_and_tree('.') |
27 |
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' |
28 |
tree.lock_read() |
29 |
self.addCleanup(tree.unlock) |
|
1852.6.1
by Robert Collins
Start tree implementation tests. |
30 |
self.assertEqual([], tree.get_parent_ids()) |
31 |
self.assertEqual([], tree.conflicts()) |
|
32 |
self.assertEqual([], list(tree.unknowns())) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
33 |
self.assertEqual(['empty-root-id'], list(iter(tree))) |
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
34 |
self.assertEqual( |
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
35 |
[('', 'empty-root-id')], |
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
36 |
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()]) |
37 |
||
38 |
def test_abc_tree_no_parents(self): |
|
1852.8.7
by Robert Collins
Update tree_implementation test tree factories to be intertree ready. |
39 |
tree = self.make_branch_and_tree('.') |
40 |
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' |
41 |
tree.lock_read() |
42 |
self.addCleanup(tree.unlock) |
|
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
43 |
self.assertEqual([], tree.get_parent_ids()) |
44 |
self.assertEqual([], tree.conflicts()) |
|
45 |
self.assertEqual([], list(tree.unknowns())) |
|
46 |
# __iter__ has no strongly defined order
|
|
47 |
self.assertEqual( |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
48 |
set(['root-id', 'a-id', 'b-id', 'c-id']), |
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
49 |
set(iter(tree))) |
50 |
self.assertEqual( |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
51 |
[('', '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. |
52 |
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()]) |
53 |
self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id')) |
|
54 |
self.assertFalse(tree.is_executable('c-id')) |
|
55 |
||
56 |
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. |
57 |
tree = self.make_branch_and_tree('.') |
58 |
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' |
59 |
tree.lock_read() |
60 |
self.addCleanup(tree.unlock) |
|
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
61 |
self.assertEqual([], tree.get_parent_ids()) |
62 |
self.assertEqual([], tree.conflicts()) |
|
63 |
self.assertEqual([], list(tree.unknowns())) |
|
64 |
# __iter__ has no strongly defined order
|
|
65 |
self.assertEqual( |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
66 |
set(['root-id', 'a-id', 'b-id', 'c-id']), |
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
67 |
set(iter(tree))) |
68 |
self.assertEqual( |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
69 |
[('', '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. |
70 |
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()]) |
71 |
self.assertEqualDiff('foobar\n', tree.get_file_text('a-id')) |
|
72 |
self.assertFalse(tree.is_executable('c-id')) |
|
2255.2.64
by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations' |
73 |
|
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
74 |
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. |
75 |
tree = self.make_branch_and_tree('.') |
76 |
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' |
77 |
tree.lock_read() |
78 |
self.addCleanup(tree.unlock) |
|
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
79 |
self.assertEqual([], tree.get_parent_ids()) |
80 |
self.assertEqual([], tree.conflicts()) |
|
81 |
self.assertEqual([], list(tree.unknowns())) |
|
82 |
# __iter__ has no strongly defined order
|
|
83 |
self.assertEqual( |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
84 |
set(['root-id', 'a-id', 'b-id', 'c-id']), |
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
85 |
set(iter(tree))) |
86 |
self.assertEqual( |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
87 |
[('', '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. |
88 |
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()]) |
89 |
self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id')) |
|
90 |
self.assertTrue(tree.is_executable('c-id')) |
|
2255.2.64
by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations' |
91 |
|
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
92 |
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. |
93 |
tree = self.make_branch_and_tree('.') |
94 |
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' |
95 |
tree.lock_read() |
96 |
self.addCleanup(tree.unlock) |
|
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
97 |
self.assertEqual([], tree.get_parent_ids()) |
98 |
self.assertEqual([], tree.conflicts()) |
|
99 |
self.assertEqual([], list(tree.unknowns())) |
|
100 |
# __iter__ has no strongly defined order
|
|
101 |
self.assertEqual( |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
102 |
set(['root-id', 'a-id', 'b-id', 'c-id']), |
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
103 |
set(iter(tree))) |
104 |
self.assertEqual( |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
105 |
[('', '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. |
106 |
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()]) |
107 |
self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id')) |
|
108 |
self.assertFalse(tree.is_executable('c-id')) |
|
2255.2.64
by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations' |
109 |
|
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
110 |
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. |
111 |
tree = self.make_branch_and_tree('.') |
112 |
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' |
113 |
tree.lock_read() |
114 |
self.addCleanup(tree.unlock) |
|
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
115 |
self.assertEqual([], tree.get_parent_ids()) |
116 |
self.assertEqual([], tree.conflicts()) |
|
117 |
self.assertEqual([], list(tree.unknowns())) |
|
118 |
# __iter__ has no strongly defined order
|
|
119 |
self.assertEqual( |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
120 |
set(['root-id', 'a-id', 'b-id', 'c-id']), |
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
121 |
set(iter(tree))) |
122 |
self.assertEqual( |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
123 |
[('', '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. |
124 |
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()]) |
125 |
self.assertEqualDiff('bar\n', tree.get_file_text('a-id')) |
|
126 |
self.assertFalse(tree.is_executable('c-id')) |
|
2255.2.64
by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations' |
127 |
|
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
128 |
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. |
129 |
tree = self.make_branch_and_tree('.') |
130 |
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' |
131 |
tree.lock_read() |
132 |
self.addCleanup(tree.unlock) |
|
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
133 |
self.assertEqual([], tree.get_parent_ids()) |
134 |
self.assertEqual([], tree.conflicts()) |
|
135 |
self.assertEqual([], list(tree.unknowns())) |
|
136 |
# __iter__ has no strongly defined order
|
|
137 |
self.assertEqual( |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
138 |
set(['root-id', 'a-id', 'b-id', 'c-id']), |
1852.6.9
by Robert Collins
Add more test trees to the tree-implementations tests. |
139 |
set(iter(tree))) |
140 |
self.assertEqual( |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
141 |
[('', '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. |
142 |
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()]) |
143 |
self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id')) |
|
144 |
self.assertTrue(tree.is_executable('c-id')) |
|
2294.1.1
by John Arbash Meinel
Track down some non-ascii deficiencies in commit logic. |
145 |
|
1852.15.1
by Robert Collins
Add a complex test tree for use with Tree.walkdirs. |
146 |
def test_tree_with_subdirs_and_all_content_types(self): |
147 |
# currently this test tree requires unicode. It might be good
|
|
148 |
# to have it simply stop having the single unicode file in it
|
|
149 |
# when dealing with a non-unicode filesystem.
|
|
2949.5.1
by Alexander Belchenko
selftest: use SymlinkFeature instead of TestSkipped where appropriate |
150 |
self.requireFeature(SymlinkFeature) |
1852.15.1
by Robert Collins
Add a complex test tree for use with Tree.walkdirs. |
151 |
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' |
152 |
tree.lock_read() |
153 |
self.addCleanup(tree.unlock) |
|
1852.15.1
by Robert Collins
Add a complex test tree for use with Tree.walkdirs. |
154 |
self.assertEqual([], tree.get_parent_ids()) |
155 |
self.assertEqual([], tree.conflicts()) |
|
156 |
self.assertEqual([], list(tree.unknowns())) |
|
157 |
# __iter__ has no strongly defined order
|
|
2255.2.17
by Robert Collins
tweaks - finishes off all the test_test_trees tests for dirstate. |
158 |
tree_root = tree.path2id('') |
1852.15.1
by Robert Collins
Add a complex test tree for use with Tree.walkdirs. |
159 |
self.assertEqual( |
2255.2.17
by Robert Collins
tweaks - finishes off all the test_test_trees tests for dirstate. |
160 |
set([tree_root, |
1852.15.1
by Robert Collins
Add a complex test tree for use with Tree.walkdirs. |
161 |
'2file', |
162 |
'1top-dir', |
|
163 |
'1file-in-1topdir', |
|
164 |
'0dir-in-1topdir', |
|
2255.2.107
by John Arbash Meinel
(working), fix dirstate to use utf8 file ids. |
165 |
u'0utf\u1234file'.encode('utf8'), |
1852.15.1
by Robert Collins
Add a complex test tree for use with Tree.walkdirs. |
166 |
'symlink', |
167 |
]),
|
|
168 |
set(iter(tree))) |
|
169 |
# note that the order of the paths and fileids is deliberately
|
|
170 |
# mismatched to ensure that the result order is path based.
|
|
171 |
self.assertEqual( |
|
2255.2.17
by Robert Collins
tweaks - finishes off all the test_test_trees tests for dirstate. |
172 |
[('', tree_root, 'directory'), |
1852.15.1
by Robert Collins
Add a complex test tree for use with Tree.walkdirs. |
173 |
('0file', '2file', 'file'), |
174 |
('1top-dir', '1top-dir', 'directory'), |
|
2255.2.107
by John Arbash Meinel
(working), fix dirstate to use utf8 file ids. |
175 |
(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. |
176 |
('symlink', 'symlink', 'symlink'), |
177 |
('1top-dir/0file-in-1topdir', '1file-in-1topdir', 'file'), |
|
178 |
('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')], |
|
179 |
[(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) |
180 |
|
2408.1.3
by Alexander Belchenko
tree_implementations: make usage of symlinks optional |
181 |
def test_tree_with_subdirs_and_all_content_types_wo_symlinks(self): |
182 |
# currently this test tree requires unicode. It might be good
|
|
183 |
# to have it simply stop having the single unicode file in it
|
|
184 |
# when dealing with a non-unicode filesystem.
|
|
185 |
tree = self.get_tree_with_subdirs_and_all_supported_content_types(False) |
|
186 |
tree.lock_read() |
|
187 |
self.addCleanup(tree.unlock) |
|
188 |
self.assertEqual([], tree.get_parent_ids()) |
|
189 |
self.assertEqual([], tree.conflicts()) |
|
190 |
self.assertEqual([], list(tree.unknowns())) |
|
191 |
# __iter__ has no strongly defined order
|
|
192 |
tree_root = tree.path2id('') |
|
193 |
self.assertEqual( |
|
194 |
set([tree_root, |
|
195 |
'2file', |
|
196 |
'1top-dir', |
|
197 |
'1file-in-1topdir', |
|
198 |
'0dir-in-1topdir', |
|
199 |
u'0utf\u1234file'.encode('utf8'), |
|
200 |
]),
|
|
201 |
set(iter(tree))) |
|
202 |
# note that the order of the paths and fileids is deliberately
|
|
203 |
# mismatched to ensure that the result order is path based.
|
|
204 |
self.assertEqual( |
|
205 |
[('', tree_root, 'directory'), |
|
206 |
('0file', '2file', 'file'), |
|
207 |
('1top-dir', '1top-dir', 'directory'), |
|
208 |
(u'2utf\u1234file', u'0utf\u1234file'.encode('utf8'), 'file'), |
|
209 |
('1top-dir/0file-in-1topdir', '1file-in-1topdir', 'file'), |
|
210 |
('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')], |
|
211 |
[(path, node.file_id, node.kind) for path, node in tree.iter_entries_by_dir()]) |
|
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('.') |
|
215 |
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 |
216 |
|
2294.1.3
by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed. |
217 |
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 |
218 |
root_id = 'TREE_ROOT' |
219 |
bar_id = u'b\xe5r-id'.encode('utf8') |
|
220 |
foo_id = u'f\xf6-id'.encode('utf8') |
|
221 |
baz_id = u'b\xe1z-id'.encode('utf8') |
|
222 |
path_and_ids = [(u'', root_id, None), |
|
223 |
(u'b\xe5r', bar_id, root_id), |
|
224 |
(u'f\xf6', foo_id, root_id), |
|
225 |
(u'b\xe5r/b\xe1z', baz_id, bar_id), |
|
2294.1.3
by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed. |
226 |
]
|
227 |
tree.lock_read() |
|
228 |
try: |
|
229 |
path_entries = list(tree.iter_entries_by_dir()) |
|
230 |
finally: |
|
231 |
tree.unlock() |
|
232 |
||
2294.1.7
by John Arbash Meinel
Add tests for parent ids in test_test_trees |
233 |
for expected, (path, ie) in zip(path_and_ids, path_entries): |
234 |
self.assertEqual(expected[0], path) # Paths should match |
|
235 |
self.assertIsInstance(path, unicode) |
|
236 |
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 |
237 |
self.assertIsInstance(ie.file_id, str) |
2294.1.7
by John Arbash Meinel
Add tests for parent ids in test_test_trees |
238 |
self.assertEqual(expected[2], ie.parent_id) |
239 |
if expected[2] is not None: |
|
2294.1.10
by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass |
240 |
self.assertIsInstance(ie.parent_id, str) |
2294.1.3
by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed. |
241 |
# 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 |
242 |
if ie.revision is not None: |
243 |
self.assertIsInstance(ie.revision, str) |
|
244 |
if expected[0] != '': |
|
2294.1.3
by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed. |
245 |
# Some trees will preserve the revision id of the tree root,
|
246 |
# but not all will
|
|
2294.1.7
by John Arbash Meinel
Add tests for parent ids in test_test_trees |
247 |
self.assertEqual(revision_id, ie.revision) |
2294.1.3
by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed. |
248 |
self.assertEqual(len(path_and_ids), len(path_entries)) |
249 |
get_revision_id = getattr(tree, 'get_revision_id', None) |
|
250 |
if get_revision_id is not None: |
|
251 |
self.assertIsInstance(get_revision_id(), str) |
|
252 |
last_revision = getattr(tree, 'last_revision', None) |
|
253 |
if last_revision is not None: |
|
254 |
self.assertIsInstance(last_revision(), str) |
|
255 |
||
2294.1.2
by John Arbash Meinel
Track down and add tests that all tree.commit() can handle |
256 |
def test_tree_with_merged_utf8(self): |
257 |
tree = self.make_branch_and_tree('.') |
|
258 |
tree = self.get_tree_with_merged_utf8(tree) |
|
2294.1.3
by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed. |
259 |
|
260 |
revision_id_1 = u'r\xe9v-1'.encode('utf8') |
|
261 |
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 |
262 |
root_id = 'TREE_ROOT' |
263 |
bar_id = u'b\xe5r-id'.encode('utf8') |
|
264 |
foo_id = u'f\xf6-id'.encode('utf8') |
|
265 |
baz_id = u'b\xe1z-id'.encode('utf8') |
|
266 |
zez_id = u'z\xf7z-id'.encode('utf8') |
|
267 |
path_and_ids = [(u'', root_id, None, None), |
|
268 |
(u'b\xe5r', bar_id, root_id, revision_id_1), |
|
269 |
(u'f\xf6', foo_id, root_id, revision_id_1), |
|
270 |
(u'b\xe5r/b\xe1z', baz_id, bar_id, revision_id_1), |
|
271 |
(u'b\xe5r/z\xf7z', zez_id, bar_id, revision_id_2), |
|
2294.1.3
by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed. |
272 |
]
|
273 |
tree.lock_read() |
|
274 |
try: |
|
275 |
path_entries = list(tree.iter_entries_by_dir()) |
|
276 |
finally: |
|
277 |
tree.unlock() |
|
278 |
||
2294.1.7
by John Arbash Meinel
Add tests for parent ids in test_test_trees |
279 |
for expected, (path, ie) in zip(path_and_ids, path_entries): |
280 |
self.assertEqual(expected[0], path) # Paths should match |
|
281 |
self.assertIsInstance(path, unicode) |
|
282 |
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 |
283 |
self.assertIsInstance(ie.file_id, str) |
2294.1.7
by John Arbash Meinel
Add tests for parent ids in test_test_trees |
284 |
self.assertEqual(expected[2], ie.parent_id) |
285 |
if expected[2] is not None: |
|
2294.1.10
by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass |
286 |
self.assertIsInstance(ie.parent_id, str) |
2294.1.3
by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed. |
287 |
# 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 |
288 |
if ie.revision is not None: |
289 |
self.assertIsInstance(ie.revision, str) |
|
2294.1.3
by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed. |
290 |
if expected[0] == '': |
291 |
# Some trees will preserve the revision id of the tree root,
|
|
292 |
# but not all will
|
|
293 |
continue
|
|
2294.1.7
by John Arbash Meinel
Add tests for parent ids in test_test_trees |
294 |
self.assertEqual(expected[3], ie.revision) |
2294.1.3
by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed. |
295 |
self.assertEqual(len(path_and_ids), len(path_entries)) |
296 |
get_revision_id = getattr(tree, 'get_revision_id', None) |
|
297 |
if get_revision_id is not None: |
|
298 |
self.assertIsInstance(get_revision_id(), str) |
|
299 |
last_revision = getattr(tree, 'last_revision', None) |
|
300 |
if last_revision is not None: |
|
301 |
self.assertIsInstance(last_revision(), str) |