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
 | 
|
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'))  | 
|
| 
3363.2.7
by Aaron Bentley
 Implement alterntative-to-inventory tests  | 
54  | 
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.  | 
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)))  | 
|
| 
3943.8.1
by Marius Kruger
 remove all trailing whitespace from bzr source  | 
169  | 
        # 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.  | 
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)))  | 
|
| 
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(  | 
|
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'  | 
| 
3638.3.12
by Vincent Ladeuil
 Fix test missed in the previous commit (--starting-with doesn't  | 
219  | 
bar_id = u'ba\N{Euro Sign}r-id'.encode('utf8')  | 
220  | 
foo_id = u'fo\N{Euro Sign}o-id'.encode('utf8')  | 
|
221  | 
baz_id = u'ba\N{Euro Sign}z-id'.encode('utf8')  | 
|
222  | 
path_and_ids = [(u'', root_id, None, None),  | 
|
223  | 
(u'ba\N{Euro Sign}r', bar_id, root_id, revision_id),  | 
|
224  | 
(u'fo\N{Euro Sign}o', foo_id, root_id, revision_id),  | 
|
225  | 
(u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',  | 
|
226  | 
baz_id, bar_id, revision_id),  | 
|
| 
2294.1.3
by John Arbash Meinel
 Make sure the inventory enrtries returned are properly formed.  | 
227  | 
                       ]
 | 
228  | 
tree.lock_read()  | 
|
229  | 
try:  | 
|
230  | 
path_entries = list(tree.iter_entries_by_dir())  | 
|
231  | 
finally:  | 
|
232  | 
tree.unlock()  | 
|
233  | 
||
| 
2294.1.7
by John Arbash Meinel
 Add tests for parent ids in test_test_trees  | 
234  | 
for expected, (path, ie) in zip(path_and_ids, path_entries):  | 
235  | 
self.assertEqual(expected[0], path) # Paths should match  | 
|
236  | 
self.assertIsInstance(path, unicode)  | 
|
237  | 
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  | 
238  | 
self.assertIsInstance(ie.file_id, str)  | 
| 
2294.1.7
by John Arbash Meinel
 Add tests for parent ids in test_test_trees  | 
239  | 
self.assertEqual(expected[2], ie.parent_id)  | 
240  | 
if expected[2] is not None:  | 
|
| 
2294.1.10
by John Arbash Meinel
 Switch all apis over to utf8 file ids. All tests pass  | 
241  | 
self.assertIsInstance(ie.parent_id, str)  | 
| 
2294.1.3
by John Arbash Meinel
 Make sure the inventory enrtries returned are properly formed.  | 
242  | 
            # 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  | 
243  | 
if ie.revision is not None:  | 
244  | 
self.assertIsInstance(ie.revision, str)  | 
|
245  | 
if expected[0] != '':  | 
|
| 
2294.1.3
by John Arbash Meinel
 Make sure the inventory enrtries returned are properly formed.  | 
246  | 
                    # Some trees will preserve the revision id of the tree root,
 | 
247  | 
                    # but not all will
 | 
|
| 
2294.1.7
by John Arbash Meinel
 Add tests for parent ids in test_test_trees  | 
248  | 
self.assertEqual(revision_id, ie.revision)  | 
| 
2294.1.3
by John Arbash Meinel
 Make sure the inventory enrtries returned are properly formed.  | 
249  | 
self.assertEqual(len(path_and_ids), len(path_entries))  | 
250  | 
get_revision_id = getattr(tree, 'get_revision_id', None)  | 
|
251  | 
if get_revision_id is not None:  | 
|
252  | 
self.assertIsInstance(get_revision_id(), str)  | 
|
253  | 
last_revision = getattr(tree, 'last_revision', None)  | 
|
254  | 
if last_revision is not None:  | 
|
255  | 
self.assertIsInstance(last_revision(), str)  | 
|
256  | 
||
| 
2294.1.2
by John Arbash Meinel
 Track down and add tests that all tree.commit() can handle  | 
257  | 
def test_tree_with_merged_utf8(self):  | 
258  | 
tree = self.make_branch_and_tree('.')  | 
|
259  | 
tree = self.get_tree_with_merged_utf8(tree)  | 
|
| 
2294.1.3
by John Arbash Meinel
 Make sure the inventory enrtries returned are properly formed.  | 
260  | 
|
261  | 
revision_id_1 = u'r\xe9v-1'.encode('utf8')  | 
|
262  | 
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  | 
263  | 
root_id = 'TREE_ROOT'  | 
| 
3638.3.11
by Vincent Ladeuil
 Fix failing tests by avoiding unicode combinig encodings (we test  | 
264  | 
bar_id = u'ba\N{Euro Sign}r-id'.encode('utf8')  | 
265  | 
foo_id = u'fo\N{Euro Sign}o-id'.encode('utf8')  | 
|
266  | 
baz_id = u'ba\N{Euro Sign}z-id'.encode('utf8')  | 
|
267  | 
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  | 
268  | 
path_and_ids = [(u'', root_id, None, None),  | 
| 
3638.3.11
by Vincent Ladeuil
 Fix failing tests by avoiding unicode combinig encodings (we test  | 
269  | 
(u'ba\N{Euro Sign}r', bar_id, root_id, revision_id_1),  | 
270  | 
(u'fo\N{Euro Sign}o', foo_id, root_id, revision_id_1),  | 
|
271  | 
(u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',  | 
|
272  | 
baz_id, bar_id, revision_id_1),  | 
|
273  | 
(u'ba\N{Euro Sign}r/qu\N{Euro Sign}x',  | 
|
274  | 
qux_id, bar_id, revision_id_2),  | 
|
| 
2294.1.3
by John Arbash Meinel
 Make sure the inventory enrtries returned are properly formed.  | 
275  | 
                       ]
 | 
276  | 
tree.lock_read()  | 
|
277  | 
try:  | 
|
278  | 
path_entries = list(tree.iter_entries_by_dir())  | 
|
279  | 
finally:  | 
|
280  | 
tree.unlock()  | 
|
281  | 
||
| 
3638.3.11
by Vincent Ladeuil
 Fix failing tests by avoiding unicode combinig encodings (we test  | 
282  | 
for (epath, efid, eparent, erev), (path, ie) in zip(path_and_ids,  | 
283  | 
path_entries):  | 
|
284  | 
self.assertEqual(epath, path) # Paths should match  | 
|
| 
2294.1.7
by John Arbash Meinel
 Add tests for parent ids in test_test_trees  | 
285  | 
self.assertIsInstance(path, unicode)  | 
| 
3638.3.11
by Vincent Ladeuil
 Fix failing tests by avoiding unicode combinig encodings (we test  | 
286  | 
self.assertEqual(efid, ie.file_id)  | 
| 
2294.1.10
by John Arbash Meinel
 Switch all apis over to utf8 file ids. All tests pass  | 
287  | 
self.assertIsInstance(ie.file_id, str)  | 
| 
3638.3.11
by Vincent Ladeuil
 Fix failing tests by avoiding unicode combinig encodings (we test  | 
288  | 
self.assertEqual(eparent, ie.parent_id)  | 
289  | 
if eparent is not None:  | 
|
| 
2294.1.10
by John Arbash Meinel
 Switch all apis over to utf8 file ids. All tests pass  | 
290  | 
self.assertIsInstance(ie.parent_id, str)  | 
| 
2294.1.3
by John Arbash Meinel
 Make sure the inventory enrtries returned are properly formed.  | 
291  | 
            # 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  | 
292  | 
if ie.revision is not None:  | 
293  | 
self.assertIsInstance(ie.revision, str)  | 
|
| 
3638.3.11
by Vincent Ladeuil
 Fix failing tests by avoiding unicode combinig encodings (we test  | 
294  | 
if epath == '':  | 
| 
2294.1.3
by John Arbash Meinel
 Make sure the inventory enrtries returned are properly formed.  | 
295  | 
                    # Some trees will preserve the revision id of the tree root,
 | 
296  | 
                    # but not all will
 | 
|
297  | 
                    continue
 | 
|
| 
3638.3.11
by Vincent Ladeuil
 Fix failing tests by avoiding unicode combinig encodings (we test  | 
298  | 
self.assertEqual(erev, ie.revision)  | 
| 
2294.1.3
by John Arbash Meinel
 Make sure the inventory enrtries returned are properly formed.  | 
299  | 
self.assertEqual(len(path_and_ids), len(path_entries))  | 
300  | 
get_revision_id = getattr(tree, 'get_revision_id', None)  | 
|
301  | 
if get_revision_id is not None:  | 
|
302  | 
self.assertIsInstance(get_revision_id(), str)  | 
|
303  | 
last_revision = getattr(tree, 'last_revision', None)  | 
|
304  | 
if last_revision is not None:  | 
|
305  | 
self.assertIsInstance(last_revision(), str)  |