D4842: treemanifests: make _loadlazy tolerate item not on _lazydirs

spectral (Kyle Lippincott) phabricator at mercurial-scm.org
Tue Oct 2 22:46:23 UTC 2018


spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I'd like to clean up a few cases where we check for an item in _lazydirs before
  calling _loadlazy - this will remove an extraneous dict lookup and make it
  slightly more versatile.

REPOSITORY
  rHG Mercurial

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

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
@@ -706,9 +706,11 @@
         self._lazydirs = {}
 
     def _loadlazy(self, d):
-        path, node, readsubtree = self._lazydirs[d]
-        self._dirs[d] = readsubtree(path, node)
-        del self._lazydirs[d]
+        v = self._lazydirs.get(d)
+        if v:
+            path, node, readsubtree = v
+            self._dirs[d] = readsubtree(path, node)
+            del self._lazydirs[d]
 
     def _loadchildrensetlazy(self, visit):
         if not visit:



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


More information about the Mercurial-devel mailing list