521
522
self.assertNotContainsRe(d, r"file 'e'")
522
523
self.assertNotContainsRe(d, r"file 'f'")
525
525
def test_binary_unicode_filenames(self):
526
526
"""Test that contents of files are *not* encoded in UTF-8 when there
527
527
is a binary file in the diff.
580
580
self.assertContainsRe(d, "=== modified file 'mod_%s'"%autf8)
581
581
self.assertContainsRe(d, "=== removed file 'del_%s'"%autf8)
583
def test_unicode_filename_path_encoding(self):
584
"""Test for bug #382699: unicode filenames on Windows should be shown
587
self.requireFeature(tests.UnicodeFilenameFeature)
588
# The word 'test' in Russian
589
_russian_test = u'\u0422\u0435\u0441\u0442'
590
directory = _russian_test + u'/'
591
test_txt = _russian_test + u'.txt'
592
u1234 = u'\u1234.txt'
594
tree = self.make_branch_and_tree('.')
595
self.build_tree_contents([
600
tree.add([test_txt, u1234, directory])
603
diff.show_diff_trees(tree.basis_tree(), tree, sio,
604
path_encoding='cp1251')
606
output = subst_dates(sio.getvalue())
608
=== added directory '%(directory)s'
609
=== added file '%(test_txt)s'
610
--- a/%(test_txt)s\tYYYY-MM-DD HH:MM:SS +ZZZZ
611
+++ b/%(test_txt)s\tYYYY-MM-DD HH:MM:SS +ZZZZ
615
=== added file '?.txt'
616
--- a/?.txt\tYYYY-MM-DD HH:MM:SS +ZZZZ
617
+++ b/?.txt\tYYYY-MM-DD HH:MM:SS +ZZZZ
621
''' % {'directory': _russian_test.encode('cp1251'),
622
'test_txt': test_txt.encode('cp1251'),
624
self.assertEqualDiff(output, shouldbe)
584
627
class DiffWasIs(diff.DiffPath):