~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

Fix bug in internal_diff handling of unicode paths

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
# list, write them out directly, etc etc.
30
30
 
31
31
def internal_diff(old_filename, oldlines, new_filename, newlines, to_file,
32
 
                  allow_binary=False, sequence_matcher=None):
 
32
                  allow_binary=False, sequence_matcher=None,
 
33
                  path_encoding='utf8'):
33
34
    # FIXME: difflib is wrong if there is no trailing newline.
34
35
    # The syntax used by patch seems to be "\ No newline at
35
36
    # end of file" following the last diff line from that
53
54
    if sequence_matcher is None:
54
55
        sequence_matcher = bzrlib.patiencediff.PatienceSequenceMatcher
55
56
    ud = unified_diff(oldlines, newlines,
56
 
                      fromfile=old_filename+'\t', 
57
 
                      tofile=new_filename+'\t',
 
57
                      fromfile=old_filename.encode(path_encoding)+'\t', 
 
58
                      tofile=new_filename.encode(path_encoding)+'\t',
58
59
                      sequencematcher=sequence_matcher)
59
60
 
60
61
    ud = list(ud)