/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: Martin
  • Date: 2010-04-22 18:36:13 UTC
  • mto: (5177.1.1 integration2)
  • mto: This revision was merged to the branch mainline in revision 5179.
  • Revision ID: gzlist@googlemail.com-20100422183613-gruiwv2xsrjf0nhp
Fix more tests which were failing under -OO that had been missed earlier

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import difflib
18
18
import os
19
19
import re
 
20
import shutil
20
21
import string
21
22
import sys
22
23
 
99
100
    if sequence_matcher is None:
100
101
        sequence_matcher = patiencediff.PatienceSequenceMatcher
101
102
    ud = patiencediff.unified_diff(oldlines, newlines,
102
 
                      fromfile=old_filename.encode(path_encoding, 'replace'),
103
 
                      tofile=new_filename.encode(path_encoding, 'replace'),
 
103
                      fromfile=old_filename.encode(path_encoding),
 
104
                      tofile=new_filename.encode(path_encoding),
104
105
                      sequencematcher=sequence_matcher)
105
106
 
106
107
    ud = list(ud)
706
707
        """
707
708
        def _get_text(tree, file_id, path):
708
709
            if file_id is not None:
709
 
                return tree.get_file_lines(file_id, path)
 
710
                return tree.get_file(file_id, path).readlines()
710
711
            else:
711
712
                return []
712
713
        try:
713
714
            from_text = _get_text(self.old_tree, from_file_id, from_path)
714
715
            to_text = _get_text(self.new_tree, to_file_id, to_path)
715
716
            self.text_differ(from_label, from_text, to_label, to_text,
716
 
                             self.to_file, path_encoding=self.path_encoding)
 
717
                             self.to_file)
717
718
        except errors.BinaryFile:
718
719
            self.to_file.write(
719
720
                  ("Binary files %s and %s differ\n" %
720
 
                  (from_label, to_label)).encode(self.path_encoding,'replace'))
 
721
                  (from_label, to_label)).encode(self.path_encoding))
721
722
        return self.CHANGED
722
723
 
723
724
 
920
921
            extra_factories = []
921
922
        if external_diff_options:
922
923
            opts = external_diff_options.split()
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
            def diff_file(olab, olines, nlab, nlines, to_file):
927
925
                external_diff(olab, olines, nlab, nlines, to_file, opts)
928
926
        else:
929
927
            diff_file = internal_diff