~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

merge diff header work from my 2.1 branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
    if sequence_matcher is None:
100
100
        sequence_matcher = patiencediff.PatienceSequenceMatcher
101
101
    ud = patiencediff.unified_diff(oldlines, newlines,
102
 
                      fromfile=old_filename.encode(path_encoding),
103
 
                      tofile=new_filename.encode(path_encoding),
 
102
                      fromfile=old_filename.encode(path_encoding, 'replace'),
 
103
                      tofile=new_filename.encode(path_encoding, 'replace'),
104
104
                      sequencematcher=sequence_matcher)
105
105
 
106
106
    ud = list(ud)
713
713
            from_text = _get_text(self.old_tree, from_file_id, from_path)
714
714
            to_text = _get_text(self.new_tree, to_file_id, to_path)
715
715
            self.text_differ(from_label, from_text, to_label, to_text,
716
 
                             self.to_file)
 
716
                             self.to_file, path_encoding=self.path_encoding)
717
717
        except errors.BinaryFile:
718
718
            self.to_file.write(
719
719
                  ("Binary files %s and %s differ\n" %
720
 
                  (from_label, to_label)).encode(self.path_encoding))
 
720
                  (from_label, to_label)).encode(self.path_encoding,'replace'))
721
721
        return self.CHANGED
722
722
 
723
723
 
920
920
            extra_factories = []
921
921
        if external_diff_options:
922
922
            opts = external_diff_options.split()
923
 
            def diff_file(olab, olines, nlab, nlines, to_file):
 
923
            def diff_file(olab, olines, nlab, nlines, to_file, path_encoding=None):
 
924
                """:param path_encoding: not used but required
 
925
                        to match the signature of internal_diff.
 
926
                """
924
927
                external_diff(olab, olines, nlab, nlines, to_file, opts)
925
928
        else:
926
929
            diff_file = internal_diff