Patchwork [07,of,10,V4] context: split `introrev` logic in a sub function

login
register
mail settings
Submitter Boris Feld
Date Oct. 4, 2018, 2:44 p.m.
Message ID <462edcfdf6346b522eee.1538664281@localhost.localdomain>
Download mbox | patch
Permalink /patch/35455/
State Accepted
Headers show

Comments

Boris Feld - Oct. 4, 2018, 2:44 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 462edcfdf6346b522eee9a64c5c1ca9ff566d7b8
# Parent  1ef29e4089dde437729f46bb6b8acb451e11a7f5
# EXP-Topic copy-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 462edcfdf634
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
@@ -771,7 +771,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
@@ -782,6 +782,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: