Re: [PATCH] Fix issue 1782 don’t do url2pathname conversion for urls

Dirkjan Ochtman dirkjan at ochtman.nl
Fri Aug 7 11:37:33 CDT 2009


On Fri, Aug 7, 2009 at 01:16, Laurens Holst<laurens.nospam at grauw.nl> wrote:
> # HG changeset patch
> # User Grauw <laurens.hg at grauw.nl>
> # Date 1249600516 -7200
> # Node ID 3ca6009819d00107a786f4ddc9f9f3845d3311b3
> # Parent  2de7d96593db63a7a06c653feb7c761bbc9e208f
> Fix issue 1782 don’t do url2pathname conversion for urls
> And only replace os-dependent path separators when necessary

Can you test it like this?

> diff -r 2de7d96593db -r 3ca6009819d0 hgext/convert/subversion.py
> --- a/hgext/convert/subversion.py       Mon Jul 27 02:27:24 2009 +0200
> +++ b/hgext/convert/subversion.py       Fri Aug 07 01:15:16 2009 +0200
> @@ -153,11 +153,13 @@
>  def issvnurl(url):
>     try:
>         proto, path = url.split('://', 1)
> -        path = urllib.url2pathname(path)
>     except ValueError:
>         proto = 'file'
>         path = os.path.abspath(url)
> -    path = path.replace(os.sep, '/')
> +    if proto == 'file':
> +        path = urllib.url2pathname(path)
> +        path = path.replace(os.sep, '/')
>     check = protomap.get(proto, lambda p, p2: False)
>     while '/' in path:
>         if check(path, proto):

It seems the url2pathname() call probably won't raise a ValueError (or
at least not the one the except clause is fixing up).

Cheers,

Dirkjan



More information about the Mercurial-devel mailing list