[PATCH 1 of 9] py3: add a new strurl() which will convert a bytes url to str

Yuya Nishihara yuya at tcha.org
Fri Jun 16 10:03:48 EDT 2017


On Fri, 16 Jun 2017 03:04:43 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1497553372 -19800
> #      Fri Jun 16 00:32:52 2017 +0530
> # Node ID c860b2b1b6b3cb9464c021167bbd85589e091225
> # Parent  877b74712132f1e2848174ee49490d328282e00d
> py3: add a new strurl() which will convert a bytes url to str

Queued 1-5, 7, and 9, thanks.
> 
> diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
> --- a/mercurial/pycompat.py
> +++ b/mercurial/pycompat.py
> @@ -149,6 +149,10 @@
>          def __iter__(self):
>              return iterbytestr(bytes.__iter__(self))
>  
> +    def strurl(url):
> +        """Converts a bytes url back to str"""
> +        return url.decode(u'ascii')

I've moved this next to sysstr() so the order matches with py2 block.

> @@ -244,6 +248,7 @@
>      iterbytestr = iter
>      sysbytes = identity
>      sysstr = identity
> +    strurl = identity


More information about the Mercurial-devel mailing list