Mercurial > hg
comparison tests/test-convert-svn-encoding.t @ 45027:0ea9c86fac89 stable 5.4.2
convert: handle percent-encoded bytes in file URLs like Subversion
75b59d221aa3 added most of the code that gets removed by this patch. It helped
making progress on Python 3, but the reasoning was wrong in many ways. I tried
to retract it while it was queued, but it was too late.
Back then, I was asssuming that what happened on Python 2 (preserving bytes) is
correct and my Python 3 change is a hack. However it turned out that Subversion
interprets percent-encoded bytes as UTF-8. Accepting the same format as
Subversion is a good idea.
Consistency with urlreq.pathname2url() (as described in the removed comment)
doesn’t matter because that function is only used for passing paths to urllib.
This is not a backwards-incompatible change because before 5c0d5b48e58c,
non-ASCII filenames didn’t work at all on Python 2.
When the locale encoding is ISO-8859-15, `svn` accepts `file:///tmp/a%E2%82%AC`
for `/tmp/a€`. Before this patch, this was the case for this extension on
Python 3, but not on Python 2. This patch makes it work like with `svn` on both
Python 2 and Python 3.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Tue, 30 Jun 2020 07:23:29 +0200 |
parents | 6597e2a73a28 |
children | 1d075b857c90 |
comparison
equal
deleted
inserted
replaced
45026:ddf66c218104 | 45027:0ea9c86fac89 |
---|---|
195 file:/*/$TESTTMP/\xff does not look like a Bazaar repository (glob) (esc) | 195 file:/*/$TESTTMP/\xff does not look like a Bazaar repository (glob) (esc) |
196 file:/*/$TESTTMP/\xff does not look like a P4 repository (glob) (esc) | 196 file:/*/$TESTTMP/\xff does not look like a P4 repository (glob) (esc) |
197 abort: file:/*/$TESTTMP/\xff: missing or unsupported repository (glob) (esc) | 197 abort: file:/*/$TESTTMP/\xff: missing or unsupported repository (glob) (esc) |
198 [255] | 198 [255] |
199 | 199 |
200 #if py3 | 200 Subversion decodes percent-encoded bytes on the converted, UTF-8-encoded |
201 For now, on Python 3, we abort when encountering non-UTF-8 percent-encoded | 201 string. Therefore, if the percent-encoded bytes aren't valid UTF-8, Subversion |
202 bytes in a filename. | 202 would choke on them when converting them to the locale encoding. |
203 | 203 |
204 $ hg convert file://$TESTTMP/%FF test | 204 $ hg convert file://$TESTTMP/%FF test |
205 initializing destination test repository | 205 initializing destination test repository |
206 on Python 3, we currently do not support non-UTF-8 percent-encoded bytes in file URLs for Subversion repositories | 206 Subversion does not support non-UTF-8 percent-encoded bytes in file URLs |
207 file:/*/$TESTTMP/%FF does not look like a CVS checkout (glob) | 207 file:/*/$TESTTMP/%FF does not look like a CVS checkout (glob) |
208 $TESTTMP/file:$TESTTMP/%FF does not look like a Git repository | 208 $TESTTMP/file:$TESTTMP/%FF does not look like a Git repository |
209 file:/*/$TESTTMP/%FF does not look like a Subversion repository (glob) | 209 file:/*/$TESTTMP/%FF does not look like a Subversion repository (glob) |
210 file:/*/$TESTTMP/%FF is not a local Mercurial repository (glob) | 210 file:/*/$TESTTMP/%FF is not a local Mercurial repository (glob) |
211 file:/*/$TESTTMP/%FF does not look like a darcs repository (glob) | 211 file:/*/$TESTTMP/%FF does not look like a darcs repository (glob) |
213 file:/*/$TESTTMP/%FF does not look like a GNU Arch repository (glob) | 213 file:/*/$TESTTMP/%FF does not look like a GNU Arch repository (glob) |
214 file:/*/$TESTTMP/%FF does not look like a Bazaar repository (glob) | 214 file:/*/$TESTTMP/%FF does not look like a Bazaar repository (glob) |
215 file:/*/$TESTTMP/%FF does not look like a P4 repository (glob) | 215 file:/*/$TESTTMP/%FF does not look like a P4 repository (glob) |
216 abort: file:/*/$TESTTMP/%FF: missing or unsupported repository (glob) | 216 abort: file:/*/$TESTTMP/%FF: missing or unsupported repository (glob) |
217 [255] | 217 [255] |
218 #endif |