[PATCH 06 of 10 V2] context: remove duplicate manifest creation during _buildstatus

Durham Goode durham at fb.com
Tue Mar 7 22:22:38 EST 2017


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1488937790 28800
#      Tue Mar 07 17:49:50 2017 -0800
# Node ID d2850df6c891a20585a0d5eac370c1c2f4463cad
# Parent  36bcc5d848c6bdf33d604999631a0708d1b7f067
context: remove duplicate manifest creation during _buildstatus

Previously we called self.manifest() in some cases to preload the first
manifest. It turns out that self.manifest() may do extra logic that
_manifestmatches() does not, so it may be causing us extra work. The fix is to
just only do the work once.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -117,10 +117,12 @@ class basectx(object):
         # 1000 and cache it so that when you read 1001, we just need to apply a
         # delta to what's in the cache. So that's one full reconstruction + one
         # delta application.
+        mf2 = None
         if self.rev() is not None and self.rev() < other.rev():
-            self.manifest()
+            mf2 = self._manifestmatches(match, s)
         mf1 = other._manifestmatches(match, s)
-        mf2 = self._manifestmatches(match, s)
+        if mf2 is None:
+            mf2 = self._manifestmatches(match, s)
 
         modified, added = [], []
         removed = []


More information about the Mercurial-devel mailing list