~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mutabletree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-10-06 20:45:48 UTC
  • mfrom: (4728.1.2 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20091006204548-bjnc3z4k256ppimz
MutableTree.has_changes() does not require a tree parameter anymore

Show diffs side-by-side

added added

removed removed

Lines of Context:
233
233
        raise NotImplementedError(self._gather_kinds)
234
234
 
235
235
    @needs_read_lock
236
 
    def has_changes(self, from_tree):
237
 
        """Quickly check that the tree contains at least one change.
 
236
    def has_changes(self, _from_tree=None):
 
237
        """Quickly check that the tree contains at least one commitable change.
 
238
 
 
239
        :param _from_tree: tree to compare against to find changes (default to
 
240
            the basis tree and is intended to be used by tests).
238
241
 
239
242
        :return: True if a change is found. False otherwise
240
243
        """
241
 
        changes = self.iter_changes(from_tree)
 
244
        # Check pending merges
 
245
        if len(self.get_parent_ids()) > 1:
 
246
            return True
 
247
        if _from_tree is None:
 
248
            _from_tree = self.basis_tree()
 
249
        changes = self.iter_changes(_from_tree)
242
250
        try:
243
251
            change = changes.next()
244
252
            # Exclude root (talk about black magic... --vila 20090629)