From patchwork Wed Oct 3 19:10:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4,of,8,V3] context: split `introrev` logic in a sub function From: Boris Feld X-Patchwork-Id: 35419 Message-Id: <759af590645e2f0cc6fb.1538593847@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Cc: gregory.szorc@gmail.com Date: Wed, 03 Oct 2018 21:10:47 +0200 # HG changeset patch # User Boris Feld # 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. 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()