4
from bzrlib import errors, osutils
4
5
from bzrlib.add import smart_add, smart_add_tree
5
from bzrlib.tests import TestCaseWithTransport, TestCase
6
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
6
7
from bzrlib.errors import NoSuchFile
7
8
from bzrlib.inventory import InventoryFile, Inventory
8
9
from bzrlib.workingtree import WorkingTree
212
213
'Accidentally added path: %s' % (path,))
216
class TestAddNonNormalized(TestCaseWithTransport):
220
self.build_tree([u'a\u030a'])
222
raise TestSkipped('Filesystem cannot create unicode filenames')
224
self.wt = self.make_branch_and_tree('.')
226
def test_accessible_explicit(self):
228
orig = osutils.normalized_filename
229
osutils.normalized_filename = osutils._accessible_normalized_filename
231
smart_add_tree(self.wt, [u'a\u030a'])
232
self.assertEqual([(u'\xe5', 'file')],
233
[(path, ie.kind) for path,ie in
234
self.wt.inventory.iter_entries()])
236
osutils.normalized_filename = orig
238
def test_accessible_implicit(self):
240
orig = osutils.normalized_filename
241
osutils.normalized_filename = osutils._accessible_normalized_filename
243
smart_add_tree(self.wt, [])
244
self.assertEqual([(u'\xe5', 'file')],
245
[(path, ie.kind) for path,ie in
246
self.wt.inventory.iter_entries()])
248
osutils.normalized_filename = orig
250
def test_inaccessible_explicit(self):
252
orig = osutils.normalized_filename
253
osutils.normalized_filename = osutils._inaccessible_normalized_filename
255
self.assertRaises(errors.InvalidNormalization,
256
smart_add_tree, self.wt, [u'a\u030a'])
258
osutils.normalized_filename = orig
260
def test_inaccessible_implicit(self):
262
orig = osutils.normalized_filename
263
osutils.normalized_filename = osutils._inaccessible_normalized_filename
265
# TODO: jam 20060701 In the future, this should probably
266
# just ignore files that don't fit the normalization
267
# rules, rather than exploding
268
self.assertRaises(errors.InvalidNormalization,
269
smart_add_tree, self.wt, [])
271
osutils.normalized_filename = orig
215
274
class TestAddActions(TestCase):
217
276
def test_quiet(self):