tests/readlink.py
author Pierre-Yves David <pierre-yves.david@fb.com>
Mon, 06 Oct 2014 11:43:32 -0700
changeset 22814 8110405cf8ae
parent 10282 08a0f04b56bd
child 25660 328739ea70c3
permissions -rwxr-xr-x
revset-limit: use boolean testing instead of `len(revs) < 1` I'm not sure why we wrote it that way. But smartsets have faster/lazier non-zero testing than length computation.

#!/usr/bin/env python

import errno, os, sys

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

sys.exit(0)