~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

Update test support, and remove deprecated functions pullable_revisions and get_intervening_revisions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
190
190
 
191
191
 
192
192
def diff_cmd_helper(tree, specific_files, external_diff_options, 
193
 
                    old_revision_spec=None, new_revision_spec=None):
 
193
                    old_revision_spec=None, new_revision_spec=None,
 
194
                    old_label='a/', new_label='b/'):
194
195
    """Helper for cmd_diff.
195
196
 
196
197
   tree 
229
230
        new_tree = spec_tree(new_revision_spec)
230
231
 
231
232
    return show_diff_trees(old_tree, new_tree, sys.stdout, specific_files,
232
 
                           external_diff_options)
 
233
                           external_diff_options,
 
234
                           old_label=old_label, new_label=new_label)
233
235
 
234
236
 
235
237
def show_diff_trees(old_tree, new_tree, to_file, specific_files=None,
236
 
                    external_diff_options=None):
 
238
                    external_diff_options=None,
 
239
                    old_label='a/', new_label='b/'):
237
240
    """Show in text form the changes from one tree to another.
238
241
 
239
242
    to_files
247
250
        new_tree.lock_read()
248
251
        try:
249
252
            return _show_diff_trees(old_tree, new_tree, to_file,
250
 
                                    specific_files, external_diff_options)
 
253
                                    specific_files, external_diff_options,
 
254
                                    old_label=old_label, new_label=new_label)
251
255
        finally:
252
256
            new_tree.unlock()
253
257
    finally:
255
259
 
256
260
 
257
261
def _show_diff_trees(old_tree, new_tree, to_file,
258
 
                     specific_files, external_diff_options):
259
 
 
260
 
    # TODO: Options to control putting on a prefix or suffix, perhaps
261
 
    # as a format string?
262
 
    old_label = 'a/'
263
 
    new_label = 'b/'
 
262
                     specific_files, external_diff_options, 
 
263
                     old_label='a/', new_label='b/' ):
264
264
 
265
265
    DEVNULL = '/dev/null'
266
266
    # Windows users, don't panic about this filename -- it is a
286
286
    has_changes = 0
287
287
    for path, file_id, kind in delta.removed:
288
288
        has_changes = 1
289
 
        print >>to_file, '=== removed %s %r' % (kind, old_label + path)
 
289
        print >>to_file, '=== removed %s %r' % (kind, path)
290
290
        old_tree.inventory[file_id].diff(diff_file, old_label + path, old_tree,
291
291
                                         DEVNULL, None, None, to_file)
292
292
    for path, file_id, kind in delta.added:
293
293
        has_changes = 1
294
 
        print >>to_file, '=== added %s %r' % (kind, new_label + path)
 
294
        print >>to_file, '=== added %s %r' % (kind, path)
295
295
        new_tree.inventory[file_id].diff(diff_file, new_label + path, new_tree,
296
296
                                         DEVNULL, None, None, to_file, 
297
297
                                         reverse=True)
300
300
        has_changes = 1
301
301
        prop_str = get_prop_change(meta_modified)
302
302
        print >>to_file, '=== renamed %s %r => %r%s' % (
303
 
                    kind, old_label + old_path, new_label + new_path, prop_str)
 
303
                    kind, old_path, new_path, prop_str)
304
304
        _maybe_diff_file_or_symlink(old_label, old_path, old_tree, file_id,
305
305
                                    new_label, new_path, new_tree,
306
306
                                    text_modified, kind, to_file, diff_file)
307
307
    for path, file_id, kind, text_modified, meta_modified in delta.modified:
308
308
        has_changes = 1
309
309
        prop_str = get_prop_change(meta_modified)
310
 
        print >>to_file, '=== modified %s %r%s' % (kind, old_label + path,
311
 
                    prop_str)
 
310
        print >>to_file, '=== modified %s %r%s' % (kind, path, prop_str)
312
311
        if text_modified:
313
312
            _maybe_diff_file_or_symlink(old_label, path, old_tree, file_id,
314
313
                                        new_label, path, new_tree,