~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: 2006-04-28 09:46:27 UTC
  • mfrom: (1684.1.6 bzr.mbp.integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060428094627-39fe69886455ed98
(mbp) add --diff-prefix

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