bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
4988.10.5
by John Arbash Meinel
Merge bzr.dev 5021 to resolve NEWS |
1 |
# Copyright (C) 2007, 2009, 2010 Canonical Ltd
|
|
2255.2.62
by John Arbash Meinel
add a workingtree_implementations test that makes sure smart_add_tree orks properly |
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
|
|
2255.2.62
by John Arbash Meinel
add a workingtree_implementations test that makes sure smart_add_tree orks properly |
16 |
|
17 |
"""Test that we can use smart_add on all Tree implementations."""
|
|
18 |
||
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
19 |
from cStringIO import StringIO |
|
5378.1.1
by Martin
Add per_workingtree tests in add and smart_add for bug 205636 |
20 |
import os |
|
4789.11.1
by John Arbash Meinel
Skip the assertFilenameSkipped tests on Windows. |
21 |
import sys |
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
22 |
|
|
2255.2.62
by John Arbash Meinel
add a workingtree_implementations test that makes sure smart_add_tree orks properly |
23 |
from bzrlib import ( |
24 |
add, |
|
25 |
errors, |
|
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
26 |
ignores, |
27 |
osutils, |
|
|
2568.2.10
by Robert Collins
And a missing import. |
28 |
tests, |
|
2255.2.62
by John Arbash Meinel
add a workingtree_implementations test that makes sure smart_add_tree orks properly |
29 |
workingtree, |
30 |
)
|
|
|
5013.2.2
by Vincent Ladeuil
Fix imports in per_workingtree/test_smart_add.py. |
31 |
from bzrlib.tests import ( |
|
5013.2.3
by Vincent Ladeuil
Simplify some tests in per_workingtree/test_smart_add.py. |
32 |
features, |
|
5013.2.2
by Vincent Ladeuil
Fix imports in per_workingtree/test_smart_add.py. |
33 |
test_smart_add, |
34 |
per_workingtree, |
|
|
2255.7.92
by Martin Pool
Test for smart_add(save=false) should be run against all WorkingTrees; adjust the test to more precisely cover the contract. |
35 |
)
|
|
5013.2.2
by Vincent Ladeuil
Fix imports in per_workingtree/test_smart_add.py. |
36 |
|
37 |
||
38 |
class TestSmartAddTree(per_workingtree.TestCaseWithWorkingTree): |
|
|
2255.2.62
by John Arbash Meinel
add a workingtree_implementations test that makes sure smart_add_tree orks properly |
39 |
|
40 |
def test_single_file(self): |
|
41 |
tree = self.make_branch_and_tree('tree') |
|
42 |
self.build_tree(['tree/a']) |
|
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
43 |
tree.smart_add(['tree']) |
|
2255.2.62
by John Arbash Meinel
add a workingtree_implementations test that makes sure smart_add_tree orks properly |
44 |
|
45 |
tree.lock_read() |
|
46 |
try: |
|
47 |
files = [(path, status, kind) |
|
48 |
for path, status, kind, file_id, parent_id |
|
49 |
in tree.list_files(include_root=True)] |
|
50 |
finally: |
|
51 |
tree.unlock() |
|
52 |
self.assertEqual([('', 'V', 'directory'), ('a', 'V', 'file')], |
|
53 |
files) |
|
|
2255.7.92
by Martin Pool
Test for smart_add(save=false) should be run against all WorkingTrees; adjust the test to more precisely cover the contract. |
54 |
|
|
4634.55.1
by Robert Collins
Do not add files whose name contains new lines or carriage returns |
55 |
def assertFilenameSkipped(self, filename): |
56 |
tree = self.make_branch_and_tree('tree') |
|
|
4789.11.1
by John Arbash Meinel
Skip the assertFilenameSkipped tests on Windows. |
57 |
try: |
58 |
self.build_tree(['tree/'+filename]) |
|
59 |
except errors.NoSuchFile: |
|
60 |
if sys.platform == 'win32': |
|
61 |
raise tests.TestNotApplicable('Cannot create files named %r on' |
|
62 |
' win32' % (filename,)) |
|
|
4634.55.1
by Robert Collins
Do not add files whose name contains new lines or carriage returns |
63 |
tree.smart_add(['tree']) |
64 |
self.assertEqual(None, tree.path2id(filename)) |
|
65 |
||
66 |
def test_path_containing_newline_skips(self): |
|
67 |
self.assertFilenameSkipped('a\nb') |
|
68 |
||
69 |
def test_path_containing_carriagereturn_skips(self): |
|
70 |
self.assertFilenameSkipped('a\rb') |
|
71 |
||
|
2255.7.92
by Martin Pool
Test for smart_add(save=false) should be run against all WorkingTrees; adjust the test to more precisely cover the contract. |
72 |
def test_save_false(self): |
73 |
"""Dry-run add doesn't permanently affect the tree.""" |
|
74 |
wt = self.make_branch_and_tree('.') |
|
|
2585.1.1
by Aaron Bentley
Unify MutableTree.smart_add behavior by disabling quirky memory-only Inventory |
75 |
wt.lock_write() |
76 |
try: |
|
77 |
self.build_tree(['file']) |
|
78 |
wt.smart_add(['file'], save=False) |
|
79 |
# the file should not be added - no id.
|
|
80 |
self.assertEqual(wt.path2id('file'), None) |
|
81 |
finally: |
|
82 |
wt.unlock() |
|
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
83 |
# and the disk state should be the same - reopen to check.
|
|
2255.7.92
by Martin Pool
Test for smart_add(save=false) should be run against all WorkingTrees; adjust the test to more precisely cover the contract. |
84 |
wt = wt.bzrdir.open_workingtree() |
85 |
self.assertEqual(wt.path2id('file'), None) |
|
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
86 |
|
87 |
def test_add_dot_from_root(self): |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
88 |
"""Test adding . from the root of the tree.""" |
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
89 |
paths = ("original/", "original/file1", "original/file2") |
90 |
self.build_tree(paths) |
|
91 |
wt = self.make_branch_and_tree('.') |
|
92 |
wt.smart_add((u".",)) |
|
93 |
for path in paths: |
|
94 |
self.assertNotEqual(wt.path2id(path), None) |
|
95 |
||
96 |
def test_add_dot_from_subdir(self): |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
97 |
"""Test adding . from a subdir of the tree.""" |
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
98 |
paths = ("original/", "original/file1", "original/file2") |
99 |
self.build_tree(paths) |
|
100 |
wt = self.make_branch_and_tree('.') |
|
101 |
wt.smart_add((u".",)) |
|
102 |
for path in paths: |
|
103 |
self.assertNotEqual(wt.path2id(path), None) |
|
104 |
||
105 |
def test_add_tree_from_above_tree(self): |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
106 |
"""Test adding a tree from above the tree.""" |
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
107 |
paths = ("original/", "original/file1", "original/file2") |
108 |
branch_paths = ("branch/", "branch/original/", "branch/original/file1", |
|
109 |
"branch/original/file2") |
|
110 |
self.build_tree(branch_paths) |
|
111 |
wt = self.make_branch_and_tree('branch') |
|
112 |
wt.smart_add(("branch",)) |
|
113 |
for path in paths: |
|
114 |
self.assertNotEqual(wt.path2id(path), None) |
|
115 |
||
116 |
def test_add_above_tree_preserves_tree(self): |
|
117 |
"""Test nested trees are not affect by an add above them.""" |
|
118 |
paths = ("original/", "original/file1", "original/file2") |
|
119 |
child_paths = ("path",) |
|
120 |
full_child_paths = ("original/child", "original/child/path") |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
121 |
build_paths = ("original/", "original/file1", "original/file2", |
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
122 |
"original/child/", "original/child/path") |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
123 |
|
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
124 |
self.build_tree(build_paths) |
125 |
wt = self.make_branch_and_tree('.') |
|
126 |
child_tree = self.make_branch_and_tree('original/child') |
|
127 |
wt.smart_add((".",)) |
|
128 |
for path in paths: |
|
129 |
self.assertNotEqual((path, wt.path2id(path)), |
|
130 |
(path, None)) |
|
131 |
for path in full_child_paths: |
|
132 |
self.assertEqual((path, wt.path2id(path)), |
|
133 |
(path, None)) |
|
134 |
for path in child_paths: |
|
135 |
self.assertEqual(child_tree.path2id(path), None) |
|
136 |
||
137 |
def test_add_paths(self): |
|
138 |
"""Test smart-adding a list of paths.""" |
|
139 |
paths = ("file1", "file2") |
|
140 |
self.build_tree(paths) |
|
141 |
wt = self.make_branch_and_tree('.') |
|
142 |
wt.smart_add(paths) |
|
143 |
for path in paths: |
|
144 |
self.assertNotEqual(wt.path2id(path), None) |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
145 |
|
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
146 |
def test_add_ignored_nested_paths(self): |
147 |
"""Test smart-adding a list of paths which includes ignored ones.""" |
|
148 |
wt = self.make_branch_and_tree('.') |
|
149 |
tree_shape = ("adir/", "adir/CVS/", "adir/CVS/afile", "adir/CVS/afile2") |
|
150 |
add_paths = ("adir/CVS", "adir/CVS/afile", "adir") |
|
151 |
expected_paths = ("adir", "adir/CVS", "adir/CVS/afile", "adir/CVS/afile2") |
|
152 |
self.build_tree(tree_shape) |
|
153 |
wt.smart_add(add_paths) |
|
154 |
for path in expected_paths: |
|
155 |
self.assertNotEqual(wt.path2id(path), None, "No id added for %s" % path) |
|
156 |
||
157 |
def test_add_non_existant(self): |
|
158 |
"""Test smart-adding a file that does not exist.""" |
|
159 |
wt = self.make_branch_and_tree('.') |
|
160 |
self.assertRaises(errors.NoSuchFile, wt.smart_add, ['non-existant-file']) |
|
161 |
||
162 |
def test_returns_and_ignores(self): |
|
163 |
"""Correctly returns added/ignored files""" |
|
164 |
wt = self.make_branch_and_tree('.') |
|
165 |
# The default ignore list includes '*.py[co]', but not CVS
|
|
166 |
ignores._set_user_ignores(['*.py[co]']) |
|
167 |
self.build_tree(['inertiatic/', 'inertiatic/esp', 'inertiatic/CVS', |
|
168 |
'inertiatic/foo.pyc']) |
|
169 |
added, ignored = wt.smart_add(u'.') |
|
170 |
self.assertSubset(('inertiatic', 'inertiatic/esp', 'inertiatic/CVS'), |
|
171 |
added) |
|
172 |
self.assertSubset(('*.py[co]',), ignored) |
|
173 |
self.assertSubset(('inertiatic/foo.pyc',), ignored['*.py[co]']) |
|
174 |
||
175 |
def test_add_multiple_dirs(self): |
|
176 |
"""Test smart adding multiple directories at once.""" |
|
177 |
added_paths = ['file1', 'file2', |
|
178 |
'dir1/', 'dir1/file3', |
|
179 |
'dir1/subdir2/', 'dir1/subdir2/file4', |
|
180 |
'dir2/', 'dir2/file5', |
|
181 |
]
|
|
182 |
not_added = ['file6', 'dir3/', 'dir3/file7', 'dir3/file8'] |
|
183 |
self.build_tree(added_paths) |
|
184 |
self.build_tree(not_added) |
|
185 |
||
186 |
wt = self.make_branch_and_tree('.') |
|
187 |
wt.smart_add(['file1', 'file2', 'dir1', 'dir2']) |
|
188 |
||
189 |
for path in added_paths: |
|
190 |
self.assertNotEqual(None, wt.path2id(path.rstrip('/')), |
|
191 |
'Failed to add path: %s' % (path,)) |
|
192 |
for path in not_added: |
|
193 |
self.assertEqual(None, wt.path2id(path.rstrip('/')), |
|
194 |
'Accidentally added path: %s' % (path,)) |
|
195 |
||
|
4163.2.1
by Ian Clatworthy
Fix add in trees supports views |
196 |
def test_add_file_in_unknown_dir(self): |
197 |
# Test that parent directory addition is implicit
|
|
198 |
tree = self.make_branch_and_tree('.') |
|
199 |
self.build_tree(['dir/', 'dir/subdir/', 'dir/subdir/foo']) |
|
200 |
tree.smart_add(['dir/subdir/foo']) |
|
201 |
tree.lock_read() |
|
202 |
self.addCleanup(tree.unlock) |
|
203 |
self.assertEqual(['', 'dir', 'dir/subdir', 'dir/subdir/foo'], |
|
204 |
[path for path, ie in tree.iter_entries_by_dir()]) |
|
205 |
||
|
5504.6.2
by Martin
If a dir being added used to be something else detect and correct |
206 |
def test_add_dir_bug_251864(self): |
|
5504.6.3
by Martin
Address poolie's review, mention both bugs in test and add news |
207 |
"""Added file turning into a dir should be detected on add dir |
208 |
||
209 |
Similar to bug 205636 but with automatic adding of directory contents.
|
|
210 |
"""
|
|
|
5378.1.1
by Martin
Add per_workingtree tests in add and smart_add for bug 205636 |
211 |
tree = self.make_branch_and_tree(".") |
212 |
self.build_tree(["dir"]) # whoops, make a file called dir |
|
213 |
tree.smart_add(["dir"]) |
|
214 |
os.remove("dir") |
|
215 |
self.build_tree(["dir/", "dir/file"]) |
|
|
5504.6.2
by Martin
If a dir being added used to be something else detect and correct |
216 |
tree.smart_add(["dir"]) |
|
5378.1.1
by Martin
Add per_workingtree tests in add and smart_add for bug 205636 |
217 |
tree.commit("Add dir contents") |
|
5378.1.4
by Martin
Assert state of the tree after add and commit in new tests |
218 |
self.addCleanup(tree.lock_read().unlock) |
219 |
self.assertEqual([(u"dir", "directory"), (u"dir/file", "file")], |
|
220 |
[(t[0], t[2]) for t in tree.list_files()]) |
|
221 |
self.assertFalse(list(tree.iter_changes(tree.basis_tree()))) |
|
|
5378.1.1
by Martin
Add per_workingtree tests in add and smart_add for bug 205636 |
222 |
|
223 |
def test_add_subdir_file_bug_205636(self): |
|
224 |
"""Added file turning into a dir should be detected on add dir/file""" |
|
225 |
tree = self.make_branch_and_tree(".") |
|
226 |
self.build_tree(["dir"]) # whoops, make a file called dir |
|
227 |
tree.smart_add(["dir"]) |
|
228 |
os.remove("dir") |
|
229 |
self.build_tree(["dir/", "dir/file"]) |
|
|
5378.1.3
by Martin
Note that TestSmartAddTree.test_add_subdir_file_bug_205636 now passes |
230 |
tree.smart_add(["dir/file"]) |
|
5378.1.1
by Martin
Add per_workingtree tests in add and smart_add for bug 205636 |
231 |
tree.commit("Add file in dir") |
|
5378.1.4
by Martin
Assert state of the tree after add and commit in new tests |
232 |
self.addCleanup(tree.lock_read().unlock) |
233 |
self.assertEqual([(u"dir", "directory"), (u"dir/file", "file")], |
|
234 |
[(t[0], t[2]) for t in tree.list_files()]) |
|
235 |
self.assertFalse(list(tree.iter_changes(tree.basis_tree()))) |
|
|
5378.1.1
by Martin
Add per_workingtree tests in add and smart_add for bug 205636 |
236 |
|
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
237 |
def test_custom_ids(self): |
238 |
sio = StringIO() |
|
|
5013.2.2
by Vincent Ladeuil
Fix imports in per_workingtree/test_smart_add.py. |
239 |
action = test_smart_add.AddCustomIDAction(to_file=sio, |
240 |
should_print=True) |
|
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
241 |
self.build_tree(['file1', 'dir1/', 'dir1/file2']) |
242 |
||
243 |
wt = self.make_branch_and_tree('.') |
|
244 |
wt.smart_add(['.'], action=action) |
|
245 |
# The order of adds is not strictly fixed:
|
|
246 |
sio.seek(0) |
|
247 |
lines = sorted(sio.readlines()) |
|
|
3985.2.5
by Daniel Watkins
Reverted some irrelevant changes. |
248 |
self.assertEqualDiff(['added dir1 with id directory-dir1\n', |
249 |
'added dir1/file2 with id file-dir1%file2\n', |
|
250 |
'added file1 with id file-file1\n', |
|
251 |
], lines) |
|
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
252 |
wt.lock_read() |
253 |
self.addCleanup(wt.unlock) |
|
254 |
self.assertEqual([('', wt.path2id('')), |
|
255 |
('dir1', 'directory-dir1'), |
|
256 |
('dir1/file2', 'file-dir1%file2'), |
|
257 |
('file1', 'file-file1'), |
|
258 |
], [(path, ie.file_id) for path, ie |
|
259 |
in wt.inventory.iter_entries()]) |
|
260 |
||
|
5013.2.3
by Vincent Ladeuil
Simplify some tests in per_workingtree/test_smart_add.py. |
261 |
|
|
5013.2.4
by Vincent Ladeuil
``bzr add`` won't blindly add conflict related files. |
262 |
class TestSmartAddConflictRelatedFiles(per_workingtree.TestCaseWithWorkingTree): |
263 |
||
264 |
def make_tree_with_text_conflict(self): |
|
265 |
tb = self.make_branch_and_tree('base') |
|
266 |
self.build_tree_contents([('base/file', 'content in base')]) |
|
267 |
tb.add('file') |
|
268 |
tb.commit('Adding file') |
|
269 |
||
270 |
t1 = tb.bzrdir.sprout('t1').open_workingtree() |
|
271 |
||
272 |
self.build_tree_contents([('base/file', 'content changed in base')]) |
|
273 |
tb.commit('Changing file in base') |
|
274 |
||
275 |
self.build_tree_contents([('t1/file', 'content in t1')]) |
|
276 |
t1.commit('Changing file in t1') |
|
277 |
t1.merge_from_branch(tb.branch) |
|
278 |
return t1 |
|
279 |
||
280 |
def test_cant_add_generated_files_implicitly(self): |
|
281 |
t = self.make_tree_with_text_conflict() |
|
282 |
added, ignored = t.smart_add([t.basedir]) |
|
283 |
self.assertEqual(([], {}), (added, ignored)) |
|
284 |
||
285 |
def test_can_add_generated_files_explicitly(self): |
|
286 |
fnames = ['file.%s' % s for s in ('BASE', 'THIS', 'OTHER')] |
|
287 |
t = self.make_tree_with_text_conflict() |
|
288 |
added, ignored = t.smart_add([t.basedir + '/%s' % f for f in fnames]) |
|
289 |
self.assertEqual((fnames, {}), (added, ignored)) |
|
290 |
||
291 |
||
|
5013.2.3
by Vincent Ladeuil
Simplify some tests in per_workingtree/test_smart_add.py. |
292 |
class TestSmartAddTreeUnicode(per_workingtree.TestCaseWithWorkingTree): |
293 |
||
294 |
_test_needs_features = [tests.UnicodeFilenameFeature] |
|
295 |
||
296 |
def setUp(self): |
|
297 |
super(TestSmartAddTreeUnicode, self).setUp() |
|
298 |
self.build_tree([u'a\u030a']) |
|
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
299 |
self.wt = self.make_branch_and_tree('.') |
|
5013.2.3
by Vincent Ladeuil
Simplify some tests in per_workingtree/test_smart_add.py. |
300 |
self.overrideAttr(osutils, 'normalized_filename') |
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
301 |
|
302 |
def test_accessible_explicit(self): |
|
303 |
osutils.normalized_filename = osutils._accessible_normalized_filename |
|
|
5013.2.6
by Vincent Ladeuil
WorkingTreeFormat2 don't support not normalized filenames. |
304 |
if isinstance(self.workingtree_format, workingtree.WorkingTreeFormat2): |
305 |
self.expectFailure( |
|
306 |
'With WorkingTreeFormat2, smart_add requires'
|
|
307 |
' normalized unicode filenames', |
|
308 |
self.assertRaises, errors.NoSuchFile, |
|
309 |
self.wt.smart_add, [u'a\u030a']) |
|
310 |
else: |
|
311 |
self.wt.smart_add([u'a\u030a']) |
|
|
5013.2.3
by Vincent Ladeuil
Simplify some tests in per_workingtree/test_smart_add.py. |
312 |
self.wt.lock_read() |
313 |
self.addCleanup(self.wt.unlock) |
|
314 |
self.assertEqual([('', 'directory'), (u'\xe5', 'file')], |
|
315 |
[(path, ie.kind) for path,ie in |
|
316 |
self.wt.inventory.iter_entries()]) |
|
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
317 |
|
318 |
def test_accessible_implicit(self): |
|
319 |
osutils.normalized_filename = osutils._accessible_normalized_filename |
|
|
5013.2.6
by Vincent Ladeuil
WorkingTreeFormat2 don't support not normalized filenames. |
320 |
if isinstance(self.workingtree_format, workingtree.WorkingTreeFormat2): |
321 |
self.expectFailure( |
|
322 |
'With WorkingTreeFormat2, smart_add requires'
|
|
323 |
' normalized unicode filenames', |
|
324 |
self.assertRaises, errors.NoSuchFile, |
|
325 |
self.wt.smart_add, []) |
|
326 |
else: |
|
327 |
self.wt.smart_add([]) |
|
|
5013.2.3
by Vincent Ladeuil
Simplify some tests in per_workingtree/test_smart_add.py. |
328 |
self.wt.lock_read() |
329 |
self.addCleanup(self.wt.unlock) |
|
330 |
self.assertEqual([('', 'directory'), (u'\xe5', 'file')], |
|
|
5013.2.6
by Vincent Ladeuil
WorkingTreeFormat2 don't support not normalized filenames. |
331 |
[(path, ie.kind) for path,ie |
332 |
in self.wt.inventory.iter_entries()]) |
|
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
333 |
|
334 |
def test_inaccessible_explicit(self): |
|
335 |
osutils.normalized_filename = osutils._inaccessible_normalized_filename |
|
|
5013.2.3
by Vincent Ladeuil
Simplify some tests in per_workingtree/test_smart_add.py. |
336 |
self.assertRaises(errors.InvalidNormalization, |
337 |
self.wt.smart_add, [u'a\u030a']) |
|
|
2568.2.4
by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now |
338 |
|
339 |
def test_inaccessible_implicit(self): |
|
340 |
osutils.normalized_filename = osutils._inaccessible_normalized_filename |
|
|
5013.2.3
by Vincent Ladeuil
Simplify some tests in per_workingtree/test_smart_add.py. |
341 |
# TODO: jam 20060701 In the future, this should probably
|
342 |
# just ignore files that don't fit the normalization
|
|
343 |
# rules, rather than exploding
|
|
344 |
self.assertRaises(errors.InvalidNormalization, self.wt.smart_add, []) |