~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Aaron Bentley
  • Date: 2006-04-19 02:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 1673.
  • Revision ID: aaron.bentley@utoronto.ca-20060419021605-7f28e84382ceef4d
Apply merge review suggestions

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
# invoke callbacks on an object.  That object can either accumulate a
26
26
# list, write them out directly, etc etc.
27
27
 
28
 
def internal_diff(old_filename, oldlines, new_filename, newlines, to_file):
 
28
def internal_diff(old_filename, oldlines, new_filename, newlines, to_file,
 
29
                  allow_binary=False):
29
30
    import difflib
30
31
    
31
32
    # FIXME: difflib is wrong if there is no trailing newline.
44
45
    if not oldlines and not newlines:
45
46
        return
46
47
    
47
 
    check_text_lines(oldlines)
48
 
    check_text_lines(newlines)
 
48
    if allow_binary is False:
 
49
        check_text_lines(oldlines)
 
50
        check_text_lines(newlines)
49
51
 
50
52
    ud = difflib.unified_diff(oldlines, newlines,
51
53
                              fromfile=old_filename+'\t',