~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-07-29 09:01:54 UTC
  • mfrom: (1852.11.3 deprecate compare_trees.)
  • Revision ID: pqm@pqm.ubuntu.com-20060729090154-4c15e5a3dc32598d
(robertc) Deprecate compare_trees and move its body to InterTree.changes_from.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from warnings import warn
23
23
 
24
24
import bzrlib
 
25
from bzrlib import delta
 
26
from bzrlib.decorators import needs_read_lock
25
27
from bzrlib.errors import BzrError, BzrCheckError
26
28
from bzrlib import errors
27
29
from bzrlib.inventory import Inventory
376
378
 
377
379
    _optimisers = set()
378
380
 
 
381
    @needs_read_lock
379
382
    def compare(self, want_unchanged=False, specific_files=None,
380
383
        extra_trees=None, require_versioned=False):
381
384
        """Return the changes from source to target.
393
396
            supplied and True all the 'specific_files' must be versioned, or
394
397
            a PathsNotVersionedError will be thrown.
395
398
        """
396
 
        # imported later to avoid circular imports
397
 
        from bzrlib.delta import compare_trees
398
 
        return compare_trees(
399
 
            self.source,
400
 
            self.target,
401
 
            want_unchanged=want_unchanged,
402
 
            specific_files=specific_files,
403
 
            extra_trees=extra_trees,
404
 
            require_versioned=require_versioned,
405
 
            )
 
399
        # NB: show_status depends on being able to pass in non-versioned files and
 
400
        # report them as unknown
 
401
        trees = (self.source, self.target)
 
402
        if extra_trees is not None:
 
403
            trees = trees + tuple(extra_trees)
 
404
        specific_file_ids = find_ids_across_trees(specific_files,
 
405
            trees, require_versioned=require_versioned)
 
406
        if specific_files and not specific_file_ids:
 
407
            # All files are unversioned, so just return an empty delta
 
408
            # _compare_trees would think we want a complete delta
 
409
            return delta.TreeDelta()
 
410
        return delta._compare_trees(self.source, self.target, want_unchanged,
 
411
            specific_file_ids)