treemanifests: make _loadlazy tolerate item not on _lazydirs
authorspectral <spectral@google.com>
Tue, 02 Oct 2018 13:37:12 -0700
changeset 39981 da0319e024c0
parent 39980 d71e0ba34d9b
child 39982 19103e68a698
treemanifests: make _loadlazy tolerate item not on _lazydirs 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. Differential Revision: https://phab.mercurial-scm.org/D4842
mercurial/manifest.py
--- a/mercurial/manifest.py	Wed Aug 08 23:17:16 2018 -0700
+++ b/mercurial/manifest.py	Tue Oct 02 13:37:12 2018 -0700
@@ -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: