# HG changeset patch # User Augie Fackler # Date 1548892157 18000 # Node ID eb6700e6c5ea8b999724b565e02a8ecaa707504e # Parent 6bbb12cba5a8f2ffdbdb6b48c79387dfc7810f5c tests: make and use a new `svnurlof.py` helper for constructing svn urls The previous trick of a Python oneliner and some subshells is too hard to make portable, and this lets us consolidate some Windows-specific logic down to a single place. Differential Revision: https://phab.mercurial-scm.org/D5766 diff -r 6bbb12cba5a8 -r eb6700e6c5ea tests/svnurlof.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/svnurlof.py Wed Jan 30 18:49:17 2019 -0500 @@ -0,0 +1,18 @@ +from __future__ import absolute_import, print_function +import sys + +from mercurial import ( + pycompat, + util, +) + +def main(argv): + enc = util.urlreq.quote(pycompat.sysbytes(argv[1])) + if pycompat.iswindows: + fmt = 'file:///%s' + else: + fmt = 'file://%s' + print(fmt % pycompat.sysstr(enc)) + +if __name__ == '__main__': + main(sys.argv) diff -r 6bbb12cba5a8 -r eb6700e6c5ea tests/test-convert-hg-svn.t --- a/tests/test-convert-hg-svn.t Wed Jan 30 17:24:57 2019 -0500 +++ b/tests/test-convert-hg-svn.t Wed Jan 30 18:49:17 2019 -0500 @@ -11,11 +11,7 @@ > EOF $ SVNREPOPATH=`pwd`/svn-repo -#if windows - $ SVNREPOURL=file:///`"$PYTHON" -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` -#else - $ SVNREPOURL=file://`"$PYTHON" -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` -#endif + $ SVNREPOURL="`$PYTHON $TESTDIR/svnurlof.py \"$SVNREPOPATH\"`" $ svnadmin create "$SVNREPOPATH" $ cat > "$SVNREPOPATH"/hooks/pre-revprop-change < egrep -v 'Committing|Transmitting|Updating|(^$)' || true