py3: add a new strurl() which will convert a bytes url to str
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 16 Jun 2017 00:32:52 +0530
changeset 32859 a05f3675c46a
parent 32858 ed1f376090cd
child 32860 f22f39d56bb5
py3: add a new strurl() which will convert a bytes url to str
mercurial/pycompat.py
--- a/mercurial/pycompat.py	Thu Jun 15 21:59:42 2017 -0400
+++ b/mercurial/pycompat.py	Fri Jun 16 00:32:52 2017 +0530
@@ -173,6 +173,10 @@
             return s
         return s.decode(u'latin-1')
 
+    def strurl(url):
+        """Converts a bytes url back to str"""
+        return url.decode(u'ascii')
+
     def raisewithtb(exc, tb):
         """Raise exception with the given traceback"""
         raise exc.with_traceback(tb)
@@ -244,6 +248,7 @@
     iterbytestr = iter
     sysbytes = identity
     sysstr = identity
+    strurl = identity
 
     # this can't be parsed on Python 3
     exec('def raisewithtb(exc, tb):\n'