~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mutabletree.py

  • Committer: Vincent Ladeuil
  • Date: 2009-07-08 13:36:29 UTC
  • mto: (4524.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4525.
  • Revision ID: v.ladeuil+lp@free.fr-20090708133629-hb2ipu8s13ek0bm7
Take review comments into account.

* bzrlib/tests/intertree_implementations/test_compare.py:
(TestIterChanges.check_has_changes): Test has_changes only if one
the trees is mutable.

* bzrlib/tree.py:
(Tree.has_changes): Moved to MutableTree.

* bzrlib/mutabletree.py:
(MutableTree.has_changes): Moved from Tree as required.

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