diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -347,6 +347,15 @@ def issvnurl(ui, url): path = os.path.abspath(url) if proto == b'file': path = util.pconvert(path) + elif proto in (b'http', 'https'): + if not encoding.isasciistr(path): + ui.warn( + _( + b"Subversion sources don't support non-ASCII characters in " + b"HTTP(S) URLs. Please percent-encode them.\n" + ) + ) + return False check = protomap.get(proto, lambda *args: False) while b'/' in path: if check(ui, path, proto): diff --git a/tests/test-convert-svn-encoding.t b/tests/test-convert-svn-encoding.t --- a/tests/test-convert-svn-encoding.t +++ b/tests/test-convert-svn-encoding.t @@ -153,6 +153,16 @@ Check tags are in UTF-8 $ cd .. +Subversion sources don't support non-ASCII characters in HTTP(S) URLs. + + $ XFF=$($PYTHON -c 'from mercurial.utils.procutil import stdout; stdout.write(b"\xff")') + $ hg convert --source-type=svn http://localhost:$HGPORT/$XFF test + initializing destination test repository + Subversion sources don't support non-ASCII characters in HTTP(S) URLs. Please percent-encode them. + http://localhost:$HGPORT/\xff does not look like a Subversion repository (esc) + abort: http://localhost:$HGPORT/\xff: missing or unsupported repository (esc) + [255] + #if py3 For now, on Python 3, we abort when encountering non-UTF-8 percent-encoded bytes in a filename.