670
671
('', [(('', 'dir', 'dir-id'), ['d', 'd'])]),
671
672
('dir', [(('dir', 'file', 'file-id'), ['a', 'f'])]),
672
673
], self.get_simple_dirblocks(state))
676
class TestIllegalPaths(TestCaseWithTransport):
678
def test_bad_fs_path(self):
679
self.requireFeature(tests.UTF8Filesystem)
680
# We require a UTF8 filesystem, because otherwise we would need to get
681
# tricky to figure out how to create an illegal filename.
682
# \xb5 is an illegal path because it should be \xc2\xb5 for UTF-8
683
tree = self.make_branch_and_tree('tree')
684
self.build_tree(['tree/subdir/'])
687
f = open('tree/subdir/m\xb5', 'wb')
694
self.addCleanup(tree.unlock)
695
basis = tree.basis_tree()
697
self.addCleanup(basis.unlock)
699
e = self.assertListRaises(errors.BadFilenameEncoding,
700
tree.iter_changes, tree.basis_tree(),
701
want_unversioned=True)
702
# We should display the relative path
703
self.assertEqual('subdir/m\xb5', e.filename)
704
self.assertEqual(osutils._fs_enc, e.fs_encoding)