changeset 40046:50700a025953

context: reverse conditional branch order in introrev Positive logic will be simpler to follow. It will help to clarify coming refactoring.
author Boris Feld <boris.feld@octobus.net>
date Thu, 04 Oct 2018 01:22:25 +0200
parents 6ed53b194124
children 8e398628a3f2
files mercurial/context.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Thu Oct 04 08:40:01 2018 +0200
+++ b/mercurial/context.py	Thu Oct 04 01:22:25 2018 +0200
@@ -777,10 +777,11 @@
         changesets.
         """
         attrs = vars(self)
-        noctx = not (r'_changeid' in attrs or r'_changectx' in attrs)
-        if noctx:
+        hastoprev = (r'_changeid' in attrs or r'_changectx' in attrs)
+        if hastoprev:
+            return self._adjustlinkrev(self.rev(), inclusive=True)
+        else:
             return self.linkrev()
-        return self._adjustlinkrev(self.rev(), inclusive=True)
 
     def introfilectx(self):
         """Return filectx having identical contents, but pointing to the