[PATCH 6 of 9] py3: convert url to str using pycompat.strurl()

Yuya Nishihara yuya at tcha.org
Fri Jun 16 10:09:06 EDT 2017


On Fri, 16 Jun 2017 03:04:48 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1497557909 -19800
> #      Fri Jun 16 01:48:29 2017 +0530
> # Node ID a7eaba4f05c56f714af870938252ebf7489845f2
> # Parent  8c2bdaf9a1901676753ed57df5a99299ded8fa08
> py3: convert url to str using pycompat.strurl()

> --- a/mercurial/httppeer.py
> +++ b/mercurial/httppeer.py
> @@ -103,6 +103,7 @@
>  
>          self.ui = ui
>          self.ui.debug('using %s\n' % self._url)
> +        self._url = pycompat.strurl(self._url)

It appears we expect bytes self._url several places. Perhaps we'll have to
convert self._url to unicode only when necessary.

> @@ -175,7 +176,7 @@
>              else:
>                  q += sorted(args.items())
>          qs = '?%s' % urlreq.urlencode(q)
> -        cu = "%s%s" % (self._url, qs)
> +        cu = r"%s%s" % (self._url, qs)

It seems wrong to concatenate unicode url and bytes qs.


More information about the Mercurial-devel mailing list