~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Michael Ellerman
  • Date: 2006-02-28 14:45:12 UTC
  • mto: (1558.1.18 Aaron's integration)
  • mto: This revision was merged to the branch mainline in revision 1586.
  • Revision ID: michael@ellerman.id.au-20060228144512-41ad7c2e3056e9ee
Change to -p1 format diffs. Update existing tests to cope, and add some
extra tests for modified/removed/renamed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
251
251
def _show_diff_trees(old_tree, new_tree, to_file,
252
252
                     specific_files, external_diff_options):
253
253
 
254
 
    # TODO: Options to control putting on a prefix or suffix, perhaps as a format string
255
 
    old_label = ''
256
 
    new_label = ''
 
254
    # TODO: Options to control putting on a prefix or suffix, perhaps
 
255
    # as a format string?
 
256
    old_label = 'a/'
 
257
    new_label = 'b/'
257
258
 
258
259
    DEVNULL = '/dev/null'
259
260
    # Windows users, don't panic about this filename -- it is a
278
279
    has_changes = 0
279
280
    for path, file_id, kind in delta.removed:
280
281
        has_changes = 1
281
 
        print >>to_file, '=== removed %s %r' % (kind, path)
 
282
        print >>to_file, '=== removed %s %r' % (kind, old_label + path)
282
283
        old_tree.inventory[file_id].diff(diff_file, old_label + path, old_tree,
283
284
                                         DEVNULL, None, None, to_file)
284
285
    for path, file_id, kind in delta.added:
285
286
        has_changes = 1
286
 
        print >>to_file, '=== added %s %r' % (kind, path)
 
287
        print >>to_file, '=== added %s %r' % (kind, new_label + path)
287
288
        new_tree.inventory[file_id].diff(diff_file, new_label + path, new_tree,
288
289
                                         DEVNULL, None, None, to_file, 
289
290
                                         reverse=True)
292
293
        has_changes = 1
293
294
        prop_str = get_prop_change(meta_modified)
294
295
        print >>to_file, '=== renamed %s %r => %r%s' % (
295
 
                          kind, old_path, new_path, prop_str)
 
296
                    kind, old_label + old_path, new_label + new_path, prop_str)
296
297
        _maybe_diff_file_or_symlink(old_label, old_path, old_tree, file_id,
297
298
                                    new_label, new_path, new_tree,
298
299
                                    text_modified, kind, to_file, diff_file)
299
300
    for path, file_id, kind, text_modified, meta_modified in delta.modified:
300
301
        has_changes = 1
301
302
        prop_str = get_prop_change(meta_modified)
302
 
        print >>to_file, '=== modified %s %r%s' % (kind, path, prop_str)
 
303
        print >>to_file, '=== modified %s %r%s' % (kind, old_label + path,
 
304
                    prop_str)
303
305
        if text_modified:
304
306
            _maybe_diff_file_or_symlink(old_label, path, old_tree, file_id,
305
307
                                        new_label, path, new_tree,