context: drop a redundant fast path in introrev
authorBoris Feld <boris.feld@octobus.net>
Thu, 04 Oct 2018 08:40:01 +0200
changeset 40045 6ed53b194124
parent 40044 ccf4d808ec4c
child 40046 50700a025953
context: drop a redundant fast path in introrev Now that _adjustlinkrev fast path this case itself, we no longer need an extra conditional. A nice side effect is that we are no longer calling `self.rev()`. In case where `_descendantrev` is set, calling `self.rev` will trigger a potentially expensive `_adjustlinkrev` call. So blindly calling `self.rev()` to avoid another `_adjustlinkrev` call can be counterproductive. Note that `_descendantrev` is currently never taken into account in `introrev` so far which is wrong. We'll fix that in changeset later in this series.
mercurial/context.py
--- a/mercurial/context.py	Thu Oct 04 08:34:59 2018 +0200
+++ b/mercurial/context.py	Thu Oct 04 08:40:01 2018 +0200
@@ -776,10 +776,9 @@
         'linkrev-shadowing' when a file revision is used by multiple
         changesets.
         """
-        lkr = self.linkrev()
         attrs = vars(self)
         noctx = not (r'_changeid' in attrs or r'_changectx' in attrs)
-        if noctx or self.rev() == lkr:
+        if noctx:
             return self.linkrev()
         return self._adjustlinkrev(self.rev(), inclusive=True)