tests/svnurlof.py
author Martin von Zweigbergk <martinvonz@google.com>
Thu, 29 Aug 2019 23:38:24 -0700
changeset 42838 f1f9ad5ae4f8
parent 41480 eb6700e6c5ea
child 43076 2372284d9457
permissions -rw-r--r--
py3: convert hg executable path to bytes in missing case in procutil We (Google) noticed this in our tests when we use chg and a hg wrapper script not called 'hg'. The executable then ended up being a native string, which then failed in chgserver when trying to convert the environment dict to a byte string. Differential Revision: https://phab.mercurial-scm.org/D6775

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)