Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 40693: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 |
comparison
equal
deleted
inserted
replaced
40692:f3f4d8537b11 | 40693:aee94f0a36cd |
---|---|
778 # We know which changelog entry we are coming from | 778 # We know which changelog entry we are coming from |
779 toprev = self._changectx.rev() | 779 toprev = self._changectx.rev() |
780 | 780 |
781 if toprev is not None: | 781 if toprev is not None: |
782 return self._adjustlinkrev(toprev, inclusive=True) | 782 return self._adjustlinkrev(toprev, inclusive=True) |
783 elif r'_descendantrev' in attrs: | |
784 introrev = self._adjustlinkrev(self._descendantrev) | |
785 # be nice and cache the result of the computation | |
786 self._changeid = introrev | |
787 return introrev | |
783 else: | 788 else: |
784 return self.linkrev() | 789 return self.linkrev() |
785 | 790 |
786 def introfilectx(self): | 791 def introfilectx(self): |
787 """Return filectx having identical contents, but pointing to the | 792 """Return filectx having identical contents, but pointing to the |