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

login
register
mail settings
Submitter Boris Feld
Date Nov. 19, 2018, 4:49 p.m.
Message ID <eb5233fcaf698c868eeb.1542646185@localhost.localdomain>
Download mbox | patch
Permalink /patch/36654/
State Accepted
Headers show

Comments

Boris Feld - Nov. 19, 2018, 4:49 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1539125436 -7200
#      Wed Oct 10 00:50:36 2018 +0200
# Node ID eb5233fcaf698c868eeb58f81fd9f890bbfaf86e
# Parent  63e215de867f1d39c18fbb34c47ca30827b3ae1c
# EXP-Topic copy-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r eb5233fcaf69
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
@@ -766,7 +766,7 @@  class basefilectx(object):
         """True if a filectx has 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: