mercurial/context.py
changeset 40692 f3f4d8537b11
parent 40671 1423ff45c322
child 40693 aee94f0a36cd
equal deleted inserted replaced
40691:a65fe13de84f 40692:f3f4d8537b11
   767         changeset the filectx was created from. It ensures the returned
   767         changeset the filectx was created from. It ensures the returned
   768         revision is one of its ancestors. This prevents bugs from
   768         revision is one of its ancestors. This prevents bugs from
   769         'linkrev-shadowing' when a file revision is used by multiple
   769         'linkrev-shadowing' when a file revision is used by multiple
   770         changesets.
   770         changesets.
   771         """
   771         """
       
   772         toprev = None
   772         attrs = vars(self)
   773         attrs = vars(self)
   773         hastoprev = (r'_changeid' in attrs or r'_changectx' in attrs)
   774         if r'_changeid' in attrs:
   774         if hastoprev:
   775             # We have a cached value already
   775             return self._adjustlinkrev(self.rev(), inclusive=True)
   776             toprev = self._changeid
       
   777         elif r'_changectx' in attrs:
       
   778             # We know which changelog entry we are coming from
       
   779             toprev = self._changectx.rev()
       
   780 
       
   781         if toprev is not None:
       
   782             return self._adjustlinkrev(toprev, inclusive=True)
   776         else:
   783         else:
   777             return self.linkrev()
   784             return self.linkrev()
   778 
   785 
   779     def introfilectx(self):
   786     def introfilectx(self):
   780         """Return filectx having identical contents, but pointing to the
   787         """Return filectx having identical contents, but pointing to the