Mercurial > public > mercurial-scm > hg-stable
diff tests/svnurlof.py @ 41494:eb6700e6c5ea
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
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 30 Jan 2019 18:49:17 -0500 |
parents | |
children | 2372284d9457 |
line wrap: on
line diff
--- /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)