tests/svnurlof.py
author Augie Fackler <augie@google.com>
Wed, 30 Jan 2019 18:49:17 -0500
changeset 41480 eb6700e6c5ea
child 43076 2372284d9457
permissions -rw-r--r--
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

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)