~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-10-19 20:12:26 UTC
  • mfrom: (2911.6.4 bzr.writes)
  • Revision ID: pqm@pqm.ubuntu.com-20071019201226-6z006xotgfe7zmu8
(Blake Winton) Switch 'print >>f' to 'f.write()' throughout the codebase

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
        to_file.write(line)
101
101
        if not line.endswith('\n'):
102
102
            to_file.write("\n\\ No newline at end of file\n")
103
 
    print >>to_file
 
103
    to_file.write('\n')
104
104
 
105
105
 
106
106
def _spawn_external_diff(diffcmd, capture_errors=True):
412
412
    for path, file_id, kind in delta.removed:
413
413
        has_changes = 1
414
414
        path_encoded = path.encode(path_encoding, "replace")
415
 
        print >>to_file, "=== removed %s '%s'" % (kind, path_encoded)
 
415
        to_file.write("=== removed %s '%s'\n" % (kind, path_encoded))
416
416
        old_name = '%s%s\t%s' % (old_label, path,
417
417
                                 _patch_header_date(old_tree, file_id, path))
418
418
        new_name = '%s%s\t%s' % (new_label, path, EPOCH_DATE)
421
421
    for path, file_id, kind in delta.added:
422
422
        has_changes = 1
423
423
        path_encoded = path.encode(path_encoding, "replace")
424
 
        print >>to_file, "=== added %s '%s'" % (kind, path_encoded)
 
424
        to_file.write("=== added %s '%s'\n" % (kind, path_encoded))
425
425
        old_name = '%s%s\t%s' % (old_label, path, EPOCH_DATE)
426
426
        new_name = '%s%s\t%s' % (new_label, path,
427
427
                                 _patch_header_date(new_tree, file_id, path))
434
434
        prop_str = get_prop_change(meta_modified)
435
435
        oldpath_encoded = old_path.encode(path_encoding, "replace")
436
436
        newpath_encoded = new_path.encode(path_encoding, "replace")
437
 
        print >>to_file, "=== renamed %s '%s' => '%s'%s" % (kind,
438
 
                            oldpath_encoded, newpath_encoded, prop_str)
 
437
        to_file.write("=== renamed %s '%s' => '%s'%s\n" % (kind,
 
438
                            oldpath_encoded, newpath_encoded, prop_str))
439
439
        old_name = '%s%s\t%s' % (old_label, old_path,
440
440
                                 _patch_header_date(old_tree, file_id,
441
441
                                                    old_path))
449
449
        has_changes = 1
450
450
        prop_str = get_prop_change(meta_modified)
451
451
        path_encoded = path.encode(path_encoding, "replace")
452
 
        print >>to_file, "=== modified %s '%s'%s" % (kind,
453
 
                            path_encoded, prop_str)
 
452
        to_file.write("=== modified %s '%s'%s\n" % (kind,
 
453
                            path_encoded, prop_str))
454
454
        # The file may be in a different location in the old tree (because
455
455
        # the containing dir was renamed, but the file itself was not)
456
456
        old_path = old_tree.id2path(file_id)