/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/diff.py

  • Committer: Jelmer Vernooij
  • Date: 2018-06-30 14:28:33 UTC
  • mfrom: (7005 work)
  • mto: This revision was merged to the branch mainline in revision 7008.
  • Revision ID: jelmer@jelmer.uk-20180630142833-eg208wfe8la76m0x
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
    # In the meantime we at least make sure the patch isn't
87
87
    # mangled.
88
88
 
89
 
 
90
 
    # Special workaround for Python2.3, where difflib fails if
91
 
    # both sequences are empty.
92
 
    if not oldlines and not newlines:
93
 
        return
94
 
 
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]))
997
991
 
998
992
            if properties_changed:
999
 
                prop_str = " (properties changed: %s)" % (", ".join(properties_changed),)
 
993
                prop_str = b" (properties changed: %s)" % (", ".join(properties_changed),)
1000
994
            else:
1001
 
                prop_str = ""
 
995
                prop_str = b""
1002
996
 
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
1011
1005
            elif renamed:
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))
1014
1008
            else:
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)