[PATCH 4 of 5 V5] context: split `introrev` logic in a sub function

Boris Feld boris.feld at octobus.net
Wed Oct 10 04:41:48 EDT 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1539125436 -7200
#      Wed Oct 10 00:50:36 2018 +0200
# Node ID 39593cc2e82294f379e9d7cfd0f9de7eca43e808
# Parent  501ef7b80a8bd6e2465cc45b40beabfbf7b31bc8
# EXP-Topic copy-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 39593cc2e822
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
@@ -766,7 +766,7 @@ class basefilectx(object):
         """True if a filectx have been introduced after a given floor revision
         """
         return (self.linkrev() >= changelogrev
-                or self.introrev() >= changelogrev)
+                or self._introrev() >= changelogrev)
 
     def introrev(self):
         """return the rev of the changeset which introduced this file revision
@@ -777,6 +777,9 @@ class basefilectx(object):
         'linkrev-shadowing' when a file revision is used by multiple
         changesets.
         """
+        return self._introrev()
+
+    def _introrev(self):
         toprev = None
         attrs = vars(self)
         if r'_changeid' in attrs:


More information about the Mercurial-devel mailing list