changeset 40732:aee94f0a36cd

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.
author Boris Feld <boris.feld@octobus.net>
date Wed, 10 Oct 2018 00:50:34 +0200
parents f3f4d8537b11
children 8a0136f69027
files mercurial/context.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Wed Oct 10 00:49:30 2018 +0200
+++ b/mercurial/context.py	Wed Oct 10 00:50:34 2018 +0200
@@ -780,6 +780,11 @@
 
         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()