changeset 32877:a05f3675c46a

py3: add a new strurl() which will convert a bytes url to str
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 16 Jun 2017 00:32:52 +0530
parents ed1f376090cd
children f22f39d56bb5
files mercurial/pycompat.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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'