comparison mercurial/manifest.py @ 39516:079d7bfa463d

treemanifest: attempt to avoid loading all lazily-loaded subdirs in _isempty Differential Revision: https://phab.mercurial-scm.org/D4367
author Kyle Lippincott <spectral@google.com>
date Thu, 23 Aug 2018 00:33:06 -0700
parents 93486cc46125
children 8798be5f04fc
comparison
equal deleted inserted replaced
39515:93486cc46125 39516:079d7bfa463d
724 724
725 __bool__ = __nonzero__ 725 __bool__ = __nonzero__
726 726
727 def _isempty(self): 727 def _isempty(self):
728 self._load() # for consistency; already loaded by all callers 728 self._load() # for consistency; already loaded by all callers
729 # See if we can skip loading everything.
730 if self._files or (self._dirs and
731 any(not m._isempty() for m in self._dirs.values())):
732 return False
729 self._loadalllazy() 733 self._loadalllazy()
730 return (not self._files and (not self._dirs or 734 return (not self._dirs or
731 all(m._isempty() for m in self._dirs.values()))) 735 all(m._isempty() for m in self._dirs.values()))
732 736
733 def __repr__(self): 737 def __repr__(self):
734 return ('<treemanifest dir=%s, node=%s, loaded=%s, dirty=%s at 0x%x>' % 738 return ('<treemanifest dir=%s, node=%s, loaded=%s, dirty=%s at 0x%x>' %
735 (self._dir, hex(self._node), 739 (self._dir, hex(self._node),
736 bool(self._loadfunc is _noop), 740 bool(self._loadfunc is _noop),