[PATCH 3 of 7 V2] context: split `introrev` logic in a sub function

Boris Feld boris.feld at octobus.net
Mon Oct 1 12:46:26 EDT 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1536255508 14400
#      Thu Sep 06 13:38:28 2018 -0400
# Node ID d29a0e8369b999cf3cf5e3b66a341ab4a50384b0
# Parent  8dc6ef0f6905826be81c4895ea33c6292ee3b860
# EXP-Topic copy-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r d29a0e8369b9
context: split `introrev` logic in a sub function

We want to add a mechanism to stop iteration early associated to intro rev early
in some case. However, it does not make sense to expose it in the public
`filectx` API. So we split the code into an internal method instead.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -831,7 +831,7 @@ class basefilectx(object):
         """True if a filectx have been introduced after a given floor revision
         """
         return (changelogrev <= self.linkrev()
-                or changelogrev <= self.introrev())
+                or changelogrev <= self._introrev())
 
     def _lazyrev(self):
         """return self.rev() if it is available without computation,
@@ -859,6 +859,9 @@ class basefilectx(object):
         'linkrev-shadowing' when a file revision is used by multiple
         changesets.
         """
+        return self._introrev()
+
+    def _introrev(self):
         lkr = self.linkrev()
         lazyrev = self._lazyrev()
         if lazyrev is not None:


More information about the Mercurial-devel mailing list