/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 bzrlib/diff.py

  • Committer: Robert Collins
  • Date: 2010-06-25 20:34:05 UTC
  • mto: This revision was merged to the branch mainline in revision 5324.
  • Revision ID: robertc@robertcollins.net-20100625203405-c74lxd3enklhaqf9
``bzrlib.osutils.get_terminal_encoding`` will now only mutter its
selection when explicitly requested; this avoids many duplicate calls
being logged when helpers, wrappers and older code that manually calls
it are executed it is now logged deliberately by the ui setup code.
(Robert Collins)

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)
706
706
        """
707
707
        def _get_text(tree, file_id, path):
708
708
            if file_id is not None:
709
 
                return tree.get_file(file_id, path).readlines()
 
709
                return tree.get_file_lines(file_id, path)
710
710
            else:
711
711
                return []
712
712
        try:
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