[PATCH 01 of 10 V4] context: fast path linkrev adjustement in trivial case

Boris Feld boris.feld at octobus.net
Thu Oct 4 14:44:35 UTC 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1538634899 -7200
#      Thu Oct 04 08:34:59 2018 +0200
# Node ID 8ae36e75e785542f415e0b1daa6f2c840542e17e
# Parent  1a4c1a3cc3f5b54de7f56753c0ea8b02b4443958
# EXP-Topic copy-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 8ae36e75e785
context: fast path linkrev adjustement in trivial case

If the search starts from the linkrev, there is nothing to adjust.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -734,6 +734,8 @@ class basefilectx(object):
         mfl = repo.manifestlog
         # fetch the linkrev
         lkr = self.linkrev()
+        if srcrev == lkr:
+            return lkr
         # hack to reuse ancestor computation when searching for renames
         memberanc = getattr(self, '_ancestrycontext', None)
         iteranc = None


More information about the Mercurial-devel mailing list