86
86
# In the meantime we at least make sure the patch isn't
90
# Special workaround for Python2.3, where difflib fails if
91
# both sequences are empty.
92
if not oldlines and not newlines:
95
89
if allow_binary is False:
96
90
textfile.check_text_lines(oldlines)
97
91
textfile.check_text_lines(newlines)
996
990
properties_changed.extend(get_executable_change(executable[0], executable[1]))
998
992
if properties_changed:
999
prop_str = " (properties changed: %s)" % (", ".join(properties_changed),)
993
prop_str = b" (properties changed: %s)" % (", ".join(properties_changed),)
1003
997
if (old_present, new_present) == (True, False):
1004
self.to_file.write("=== removed %s '%s'\n" %
1005
(kind[0], oldpath_encoded))
998
self.to_file.write(b"=== removed %s '%s'\n" %
999
(kind[0].encode('ascii'), oldpath_encoded))
1006
1000
newpath = oldpath
1007
1001
elif (old_present, new_present) == (False, True):
1008
self.to_file.write("=== added %s '%s'\n" %
1009
(kind[1], newpath_encoded))
1002
self.to_file.write(b"=== added %s '%s'\n" %
1003
(kind[1].encode('ascii'), newpath_encoded))
1010
1004
oldpath = newpath
1012
self.to_file.write("=== renamed %s '%s' => '%s'%s\n" %
1013
(kind[0], oldpath_encoded, newpath_encoded, prop_str))
1006
self.to_file.write(b"=== renamed %s '%s' => '%s'%s\n" %
1007
(kind[0].encode('ascii'), oldpath_encoded, newpath_encoded, prop_str))
1015
1009
# if it was produced by iter_changes, it must be
1016
1010
# modified *somehow*, either content or execute bit.
1017
self.to_file.write("=== modified %s '%s'%s\n" % (kind[0],
1011
self.to_file.write(b"=== modified %s '%s'%s\n" % (kind[0].encode('ascii'),
1018
1012
newpath_encoded, prop_str))
1019
1013
if changed_content:
1020
1014
self._diff(oldpath, newpath, kind[0], kind[1], file_id=file_id)