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.

--HG--
branch : stable
10 jobs for 5.4.2 in 30 minutes and 43 seconds (queued for 2 seconds)
latest
Status Job ID Name Coverage
  Test
passed #82502
checks-py2

00:02:46

passed #82503
checks-py3

00:03:02

passed #82504
rust-cargo-test-py2

00:01:37

passed #82505
rust-cargo-test-py3

00:01:29

passed #82506
test-py2

00:17:47

passed #82508
test-py2-pure

00:26:24

passed #82510
test-py2-rust

00:26:04

passed #82507
test-py3

00:23:34

passed #82509
test-py3-pure

00:20:40

failed #82511
test-py3-rust

00:12:55

 
Name Stage Failure
failed
test-py3-rust Test
Skipped test-sparse-fsmonitor.t: skipped
Skipped test-sparse-revlog.t: missing artifact, run "/tmp/mercurial-ci/tests/artifacts/scripts/generate-churning-bundle.py"
Skipped test-sqlitestore.t: missing feature: sqlite3 module is available
Skipped test-verify-repo-operations.py: missing feature: allow slow tests (use --allow-slow-tests)
Skipped test-wireproto-exchangev2-shallow.t: missing feature: sqlite3 module is available
Failed test-remotefilelog-local.t: output changed
# Ran 861 tests, 60 skipped, 1 failed.
python hash seed: 238160454
ERROR: Job failed: exit code 1