comparison mercurial/context.py @ 36639:334da951a50b

py3: fix some membership tests on linkrev adjustment
author Yuya Nishihara <yuya@tcha.org>
date Sat, 03 Mar 2018 09:19:34 -0500
parents c6061cadb400
children b529e640015d
comparison
equal deleted inserted replaced
36638:159b04de5fb0 36639:334da951a50b
910 'linkrev-shadowing' when a file revision is used by multiple 910 'linkrev-shadowing' when a file revision is used by multiple
911 changesets. 911 changesets.
912 """ 912 """
913 lkr = self.linkrev() 913 lkr = self.linkrev()
914 attrs = vars(self) 914 attrs = vars(self)
915 noctx = not ('_changeid' in attrs or '_changectx' in attrs) 915 noctx = not (r'_changeid' in attrs or r'_changectx' in attrs)
916 if noctx or self.rev() == lkr: 916 if noctx or self.rev() == lkr:
917 return self.linkrev() 917 return self.linkrev()
918 return self._adjustlinkrev(self.rev(), inclusive=True) 918 return self._adjustlinkrev(self.rev(), inclusive=True)
919 919
920 def introfilectx(self): 920 def introfilectx(self):
926 return self.filectx(self.filenode(), changeid=introrev) 926 return self.filectx(self.filenode(), changeid=introrev)
927 927
928 def _parentfilectx(self, path, fileid, filelog): 928 def _parentfilectx(self, path, fileid, filelog):
929 """create parent filectx keeping ancestry info for _adjustlinkrev()""" 929 """create parent filectx keeping ancestry info for _adjustlinkrev()"""
930 fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog) 930 fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog)
931 if '_changeid' in vars(self) or '_changectx' in vars(self): 931 if r'_changeid' in vars(self) or r'_changectx' in vars(self):
932 # If self is associated with a changeset (probably explicitly 932 # If self is associated with a changeset (probably explicitly
933 # fed), ensure the created filectx is associated with a 933 # fed), ensure the created filectx is associated with a
934 # changeset that is an ancestor of self.changectx. 934 # changeset that is an ancestor of self.changectx.
935 # This lets us later use _adjustlinkrev to get a correct link. 935 # This lets us later use _adjustlinkrev to get a correct link.
936 fctx._descendantrev = self.rev() 936 fctx._descendantrev = self.rev()
937 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) 937 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)
938 elif '_descendantrev' in vars(self): 938 elif r'_descendantrev' in vars(self):
939 # Otherwise propagate _descendantrev if we have one associated. 939 # Otherwise propagate _descendantrev if we have one associated.
940 fctx._descendantrev = self._descendantrev 940 fctx._descendantrev = self._descendantrev
941 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) 941 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)
942 return fctx 942 return fctx
943 943