view tests/readlink.py @ 38767:eb2945f0a4a1

ui: fix implicit unicode-to-bytes conversion introduced in 9df29b7c62cf This is harmless, unless you try and run hg with HGUNICODEPEDANTRY enabled. It's technically wrong, so let's go ahead and fix it. Differential Revision: https://phab.mercurial-scm.org/D3989
author Augie Fackler <augie@google.com>
date Thu, 19 Jul 2018 15:21:28 -0400
parents 6a98f9408a50
children c102b704edb5
line wrap: on
line source

#!/usr/bin/env python

from __future__ import absolute_import, print_function

import errno
import os
import sys

for f in sys.argv[1:]:
    try:
        print(f, '->', os.readlink(f))
    except OSError as err:
        if err.errno != errno.EINVAL:
            raise
        print(f, '->', f, 'not a symlink')

sys.exit(0)