Patchwork [4,of,8,V3] context: split `introrev` logic in a sub function

login
register
mail settings
Submitter Boris Feld
Date Oct. 3, 2018, 7:10 p.m.
Message ID <759af590645e2f0cc6fb.1538593847@localhost.localdomain>
Download mbox | patch
Permalink /patch/35419/
State New
Headers show

Comments

Boris Feld - Oct. 3, 2018, 7:10 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1536255508 14400
#      Thu Sep 06 13:38:28 2018 -0400
# Node ID 759af590645e2f0cc6fbed2b7b97ed718e277dc5
# Parent  eb46ac11a9a81400e96ab3db00a38944a864100f
# EXP-Topic copy-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 759af590645e
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.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -769,7 +769,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 _lazyrevavailable(self):
         """return True if self.rev() is available without computation,
@@ -797,6 +797,9 @@  class basefilectx(object):
         'linkrev-shadowing' when a file revision is used by multiple
         changesets.
         """
+        return self._introrev()
+
+    def _introrev(self):
         lkr = self.linkrev()
         attrs = vars(self)
         lazyavailable = self._lazyrevavailable()