changeset 39518:c29548ba4a75

treemanifest: avoid loading everything just to get their nodeid Differential Revision: https://phab.mercurial-scm.org/D4369
author Kyle Lippincott <spectral@google.com>
date Thu, 23 Aug 2018 00:41:20 -0700
parents 8798be5f04fc
children 5d69e2412ec8
files mercurial/manifest.py
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/manifest.py	Thu Aug 23 00:34:25 2018 -0700
+++ b/mercurial/manifest.py	Thu Aug 23 00:41:20 2018 -0700
@@ -1177,14 +1177,15 @@
         m1._load()
         m2._load()
         emptytree = treemanifest()
-        # OPT: Do we really need to load everything? Presumably things in lazy
-        # aren't dirty and don't need to be written.
-        self._loadalllazy()
-        m1._loadalllazy()
-        m2._loadalllazy()
+        def getnode(m, d):
+            ld = m._lazydirs.get(d)
+            if ld:
+                return ld[1]
+            return m._dirs.get(d, emptytree)._node
+
         for d, subm in self._dirs.iteritems():
-            subp1 = m1._dirs.get(d, emptytree)._node
-            subp2 = m2._dirs.get(d, emptytree)._node
+            subp1 = getnode(m1, d)
+            subp2 = getnode(m2, d)
             if subp1 == nullid:
                 subp1, subp2 = subp2, subp1
             writesubtree(subm, subp1, subp2)