[PATCH] url: do not encode backslash in local paths (fixes 4e8f2310f310)

Adrian Buehlmann adrian at cadifra.com
Wed Mar 30 03:23:46 CDT 2011


On 2011-03-29 03:00, Brodie Rao wrote:
> On Mon, Mar 28, 2011 at 12:53 AM, Adrian Buehlmann <adrian at cadifra.com> wrote:
>> # HG changeset patch
>> # User Adrian Buehlmann <adrian at cadifra.com>
>> # Date 1301296930 -7200
>> # Node ID 8f230f54126411b558125f064b3cd8f9d50f404d
>> # Parent  46c3043253fbd4f54bed61c4cdda2a2c198e622f
>> url: do not encode backslash in local paths (fixes 4e8f2310f310)
>>
>> It's the canonical path separator on Windows.
>>
>> BEFORE:
>>  $ hg out
>>  comparing with C:%5CUsers%5Cadi%5Chgrepos%5Ctests%5Ca
>>  searching for changes
>>  no changes found
>>
>> AFTER:
>>  $ hg out
>>  comparing with C:\Users\adi\hgrepos\tests\a
>>  searching for changes
>>  no changes found
>>
>> diff --git a/mercurial/url.py b/mercurial/url.py
>> --- a/mercurial/url.py
>> +++ b/mercurial/url.py
>> @@ -56,7 +56,7 @@ class url(object):
>>     """
>>
>>     _safechars = "!~*'()+"
>> -    _safepchars = "/!~*'()+"
>> +    _safepchars = "\\/!~*'()+"
> 
> I don't think this is enough. The data in the url object is still wrong:
> 
>>>> url(r'C:\foo')
> <url scheme: 'C', path: '\\foo'>
> 
> We should try to detect the drive letter when parsing the scheme out.
> We can do this just when os.name == 'nt'. It should do the same test
> that localpath() does and that drop_scheme() did.
> 
>>     def __init__(self, path, parse_query=True, parse_fragment=True):
>>         # We slowly chomp away at path until we have only the path left

Ok. So 4e8f2310f310 broke the default branch quite thoroughly on
Windows. And my fix is "not enough", because it apparently doesn't fix
the current breakage on the default branch completely.

Could 4e8f2310f310 and friends be backed out until this has been sorted
out? It seems these patches were pushed a bit prematurely.

I would be interested to continue to use the default branch here on
Windows 7 myself. Preferably without this broken url.py.


More information about the Mercurial-devel mailing list