D4367: treemanifest: attempt to avoid loading all lazily-loaded subdirs in _isempty

spectral (Kyle Lippincott) phabricator at mercurial-scm.org
Fri Sep 7 20:07:51 UTC 2018


spectral updated this revision to Diff 10833.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4367?vs=10545&id=10833

REVISION DETAIL
  https://phab.mercurial-scm.org/D4367

AFFECTED FILES
  mercurial/manifest.py

CHANGE DETAILS

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -726,9 +726,13 @@
 
     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 ('<treemanifest dir=%s, node=%s, loaded=%s, dirty=%s at 0x%x>' %



To: spectral, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list