tests/svnurlof.py
author Manuel Jacob <me@manueljacob.de>
Sat, 04 Jul 2020 11:15:58 +0200
changeset 45041 1053f878dd46
parent 43076 2372284d9457
child 48875 6000f5b25c9b
permissions -rw-r--r--
procutil: move assignments closer to reassignments Doing reassignments is an anti-pattern IMHO, but I see how it makes sense here. When first looking at this code after jumping here with ctags, I missed the fact that stdout was reassigned. To make the code clearer, the assignments should be as close as possible to the reassignments.

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)