/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to backend/info_helper.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-07-06 17:08:45 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060706170845-da015b629f5876a4
2006-07-06  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * I'm not dead :)
    * backend/errors.py: added some exceptions related to fileops.move()
    * backend/fileops.py: implemented move()
    * backend/info_helper.py: added diff_helper()
    * backend/info.py: implemented diff()

Show diffs side-by-side

added added

removed removed

Lines of Context:
244
244
        ret['size'] = t
245
245
 
246
246
    return ret
 
247
 
 
248
def diff_helper(tree, specific_files, external_diff_options, 
 
249
                    old_revision_spec=None, new_revision_spec=None,
 
250
                    old_label='a/', new_label='b/', output=None):
 
251
    """ Helper for diff.
 
252
 
 
253
    :param tree: a WorkingTree
 
254
 
 
255
    :param specific_files: the specific files to compare, or None
 
256
 
 
257
    :param external_diff_options: if non-None, run an external diff, and pass it these options
 
258
 
 
259
    :param old_revision_spec: if None, use basis tree as old revision, otherwise use the tree for the specified revision. 
 
260
 
 
261
    :param new_revision_spec:  if None, use working tree as new revision, otherwise use the tree for the specified revision.
 
262
    """
 
263
    import sys
 
264
    
 
265
    from bzrlib.diff import show_diff_trees
 
266
    
 
267
    if output == None:
 
268
        output = sys.stdout
 
269
    
 
270
    def spec_tree(spec):
 
271
        revision_id = spec.in_store(tree.branch).rev_id
 
272
        return tree.branch.repository.revision_tree(revision_id)
 
273
    if old_revision_spec is None:
 
274
        old_tree = tree.basis_tree()
 
275
    else:
 
276
        old_tree = spec_tree(old_revision_spec)
 
277
 
 
278
    if new_revision_spec is None:
 
279
        new_tree = tree
 
280
    else:
 
281
        new_tree = spec_tree(new_revision_spec)
 
282
 
 
283
    return show_diff_trees(old_tree, new_tree, output, specific_files,
 
284
                           external_diff_options,
 
285
                           old_label=old_label, new_label=new_label)