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

Boris Feld boris.feld at octobus.net
Fri Sep 7 11:04:09 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 f74f706f6d061cf9369cd45caa3a71d3fc03b293
# Parent  a7dba588d74f3d71c988b9a89b9591fb530a1d14
# EXP-Topic copy-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r f74f706f6d06
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
@@ -833,7 +833,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,
@@ -861,6 +861,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