mercurial/pycompat.py
changeset 32860 f22f39d56bb5
parent 32859 a05f3675c46a
child 32864 f57f1f37290d
equal deleted inserted replaced
32859:a05f3675c46a 32860:f22f39d56bb5
   175 
   175 
   176     def strurl(url):
   176     def strurl(url):
   177         """Converts a bytes url back to str"""
   177         """Converts a bytes url back to str"""
   178         return url.decode(u'ascii')
   178         return url.decode(u'ascii')
   179 
   179 
       
   180     def bytesurl(url):
       
   181         """Converts a str url to bytes by encoding in ascii"""
       
   182         return url.encode(u'ascii')
       
   183 
   180     def raisewithtb(exc, tb):
   184     def raisewithtb(exc, tb):
   181         """Raise exception with the given traceback"""
   185         """Raise exception with the given traceback"""
   182         raise exc.with_traceback(tb)
   186         raise exc.with_traceback(tb)
   183 
   187 
   184     def getdoc(obj):
   188     def getdoc(obj):
   247     bytestr = str
   251     bytestr = str
   248     iterbytestr = iter
   252     iterbytestr = iter
   249     sysbytes = identity
   253     sysbytes = identity
   250     sysstr = identity
   254     sysstr = identity
   251     strurl = identity
   255     strurl = identity
       
   256     bytesurl = identity
   252 
   257 
   253     # this can't be parsed on Python 3
   258     # this can't be parsed on Python 3
   254     exec('def raisewithtb(exc, tb):\n'
   259     exec('def raisewithtb(exc, tb):\n'
   255          '    raise exc, None, tb\n')
   260          '    raise exc, None, tb\n')
   256 
   261