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

login
register
mail settings
Submitter Boris Feld
Date Oct. 4, 2018, 2:44 p.m.
Message ID <8ae36e75e785542f415e.1538664275@localhost.localdomain>
Download mbox | patch
Permalink /patch/35449/
State Accepted
Headers show

Comments

Boris Feld - Oct. 4, 2018, 2:44 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@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.

Patch

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