~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-07-10 09:37:08 UTC
  • mfrom: (4524.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090710093708-s3ru5i9avw0pykjm
(vila) Quicker check for changes in mutable trees

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.
 
238
 
 
239
        :return: True if a change is found. False otherwise
 
240
        """
 
241
        changes = self.iter_changes(from_tree)
 
242
        try:
 
243
            change = changes.next()
 
244
            # Exclude root (talk about black magic... --vila 20090629)
 
245
            if change[4] == (None, None):
 
246
                change = changes.next()
 
247
            return True
 
248
        except StopIteration:
 
249
            # No changes
 
250
            return False
 
251
 
 
252
    @needs_read_lock
236
253
    def last_revision(self):
237
254
        """Return the revision id of the last commit performed in this tree.
238
255