# HG changeset patch # User Kyle Lippincott # Date 2018-08-23 07:33:06 # Node ID 079d7bfa463da5704412ad90a48a9211688f4854 # Parent 93486cc461251d9a3e8ce182ca07c00e1ac76ba6 treemanifest: attempt to avoid loading all lazily-loaded subdirs in _isempty Differential Revision: https://phab.mercurial-scm.org/D4367 diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -726,9 +726,13 @@ class treemanifest(object): def _isempty(self): self._load() # for consistency; already loaded by all callers + # See if we can skip loading everything. + if self._files or (self._dirs and + any(not m._isempty() for m in self._dirs.values())): + return False self._loadalllazy() - return (not self._files and (not self._dirs or - all(m._isempty() for m in self._dirs.values()))) + return (not self._dirs or + all(m._isempty() for m in self._dirs.values())) def __repr__(self): return ('' %