comparison mercurial/context.py @ 32148:2cfdf5241096

py3: use raw strings while accessing class.__dict__ The keys of class.__dict__ are unicodes on Python 3.
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 28 Apr 2017 01:13:07 +0530
parents a457da5296a5
children 8a660af9dbe3
comparison
equal deleted inserted replaced
32147:a77e61b45384 32148:2cfdf5241096
255 if len(parents) == 2: 255 if len(parents) == 2:
256 return parents[1] 256 return parents[1]
257 return changectx(self._repo, nullrev) 257 return changectx(self._repo, nullrev)
258 258
259 def _fileinfo(self, path): 259 def _fileinfo(self, path):
260 if '_manifest' in self.__dict__: 260 if r'_manifest' in self.__dict__:
261 try: 261 try:
262 return self._manifest[path], self._manifest.flags(path) 262 return self._manifest[path], self._manifest.flags(path)
263 except KeyError: 263 except KeyError:
264 raise error.ManifestLookupError(self._node, path, 264 raise error.ManifestLookupError(self._node, path,
265 _('not found in manifest')) 265 _('not found in manifest'))
266 if '_manifestdelta' in self.__dict__ or path in self.files(): 266 if r'_manifestdelta' in self.__dict__ or path in self.files():
267 if path in self._manifestdelta: 267 if path in self._manifestdelta:
268 return (self._manifestdelta[path], 268 return (self._manifestdelta[path],
269 self._manifestdelta.flags(path)) 269 self._manifestdelta.flags(path))
270 mfl = self._repo.manifestlog 270 mfl = self._repo.manifestlog
271 try: 271 try:
695 def _filelog(self): 695 def _filelog(self):
696 return self._repo.file(self._path) 696 return self._repo.file(self._path)
697 697
698 @propertycache 698 @propertycache
699 def _changeid(self): 699 def _changeid(self):
700 if '_changeid' in self.__dict__: 700 if r'_changeid' in self.__dict__:
701 return self._changeid 701 return self._changeid
702 elif '_changectx' in self.__dict__: 702 elif r'_changectx' in self.__dict__:
703 return self._changectx.rev() 703 return self._changectx.rev()
704 elif '_descendantrev' in self.__dict__: 704 elif r'_descendantrev' in self.__dict__:
705 # this file context was created from a revision with a known 705 # this file context was created from a revision with a known
706 # descendant, we can (lazily) correct for linkrev aliases 706 # descendant, we can (lazily) correct for linkrev aliases
707 return self._adjustlinkrev(self._descendantrev) 707 return self._adjustlinkrev(self._descendantrev)
708 else: 708 else:
709 return self._filelog.linkrev(self._filerev) 709 return self._filelog.linkrev(self._filerev)
710 710
711 @propertycache 711 @propertycache
712 def _filenode(self): 712 def _filenode(self):
713 if '_fileid' in self.__dict__: 713 if r'_fileid' in self.__dict__:
714 return self._filelog.lookup(self._fileid) 714 return self._filelog.lookup(self._fileid)
715 else: 715 else:
716 return self._changectx.filenode(self._path) 716 return self._changectx.filenode(self._path)
717 717
718 @propertycache 718 @propertycache
1394 1394
1395 def children(self): 1395 def children(self):
1396 return [] 1396 return []
1397 1397
1398 def flags(self, path): 1398 def flags(self, path):
1399 if '_manifest' in self.__dict__: 1399 if r'_manifest' in self.__dict__:
1400 try: 1400 try:
1401 return self._manifest.flags(path) 1401 return self._manifest.flags(path)
1402 except KeyError: 1402 except KeyError:
1403 return '' 1403 return ''
1404 1404