From patchwork Wed Oct 10 08:41:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2, of, 5, V5] context: take advantage of `_descendantrev` in introrev if available From: Boris Feld X-Patchwork-Id: 35596 Message-Id: <927d87bd28e0e7791b49.1539160906@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Wed, 10 Oct 2018 10:41:46 +0200 # HG changeset patch # User Boris Feld # Date 1539125434 -7200 # Wed Oct 10 00:50:34 2018 +0200 # Node ID 927d87bd28e0e7791b494a70701cb81a3ffad73d # Parent 37ee24df8c3b342bde56b950aa09ac0d123e0145 # EXP-Topic copy-perf # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 927d87bd28e0 context: take advantage of `_descendantrev` in introrev if available Before this changeset, `_descendantrev` was ignored and `introrev` could return a "wrong" result. I was previously fine because there seems to be no existing code using both `introrev` and `_descendantrev` at the same time. However, we would like to change that. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -782,6 +782,11 @@ class basefilectx(object): if toprev is not None: return self._adjustlinkrev(toprev, inclusive=True) + elif r'_descendantrev' in attrs: + introrev = self._adjustlinkrev(self._descendantrev) + # be nice and cache the result of the computation + self._changeid = introrev + return introrev else: return self.linkrev()