Mercurial > public > mercurial-scm > hg
comparison tests/test-url.py @ 15018:e89f62dcd723 stable
url: really handle urls of the form file:///c:/foo/bar/ correctly
28edd65000d9 made sure that paths that seemed to start with a windows drive
letter would not get an extra leading slash.
localpath should thus not try to handle this case by removing a leading slash,
and this special handling is thus removed.
(The localpath handling of this case was wrong anyway, because paths that look
like they start with a windows drive letter can't have a leading slash.)
A quick verification of this is to run 'hg id file:///c:/foo/bar/'.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 04 Aug 2011 02:51:29 +0200 |
parents | 27b080aa880a |
children | 474279be5add |
comparison
equal
deleted
inserted
replaced
15007:9991f8b19ff3 | 15018:e89f62dcd723 |
---|---|
202 >>> u = url('file:/foo/bar/baz') | 202 >>> u = url('file:/foo/bar/baz') |
203 >>> u | 203 >>> u |
204 <url scheme: 'file', path: '/foo/bar/baz'> | 204 <url scheme: 'file', path: '/foo/bar/baz'> |
205 >>> str(u) | 205 >>> str(u) |
206 'file:///foo/bar/baz' | 206 'file:///foo/bar/baz' |
207 >>> u.localpath() | |
208 '/foo/bar/baz' | |
207 | 209 |
208 >>> u = url('file:///foo/bar/baz') | 210 >>> u = url('file:///foo/bar/baz') |
209 >>> u | 211 >>> u |
210 <url scheme: 'file', path: '/foo/bar/baz'> | 212 <url scheme: 'file', path: '/foo/bar/baz'> |
211 >>> str(u) | 213 >>> str(u) |
212 'file:///foo/bar/baz' | 214 'file:///foo/bar/baz' |
215 >>> u.localpath() | |
216 '/foo/bar/baz' | |
217 | |
218 >>> u = url('file:///f:oo/bar/baz') | |
219 >>> u | |
220 <url scheme: 'file', path: 'f:oo/bar/baz'> | |
221 >>> str(u) | |
222 'file:f%3Aoo/bar/baz' | |
223 >>> u.localpath() | |
224 'f:oo/bar/baz' | |
213 | 225 |
214 >>> u = url('file:foo/bar/baz') | 226 >>> u = url('file:foo/bar/baz') |
215 >>> u | 227 >>> u |
216 <url scheme: 'file', path: 'foo/bar/baz'> | 228 <url scheme: 'file', path: 'foo/bar/baz'> |
217 >>> str(u) | 229 >>> str(u) |
218 'file:foo/bar/baz' | 230 'file:foo/bar/baz' |
231 >>> u.localpath() | |
232 'foo/bar/baz' | |
219 """ | 233 """ |
220 | 234 |
221 doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE) | 235 doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE) |