tests/readlink.py
author Matt Mackall <mpm@selenic.com>
Fri, 16 Dec 2011 18:23:15 -0600
branchstable
changeset 15661 20ae902c43ec
parent 10282 08a0f04b56bd
child 25660 328739ea70c3
permissions -rwxr-xr-x
changelog: handle decoding of NULs in extra more carefully (issue3156) Escaped NULs adjacent to [0-7] could be decoded as octal. This hits about 0.24% of changesets with transplant, which stores binary nodes.

#!/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)