tests/readlink.py
author Mads Kiilerich <mads@kiilerich.com>
Fri, 29 Jun 2012 01:51:48 +0200
changeset 17053 0e4171fdb9d4
parent 10282 08a0f04b56bd
child 25660 328739ea70c3
permissions -rwxr-xr-x
convert: check for failed svn import in debugsvnlog and abort cleanly 'hg debugsvnlog' failed with a crash when using the uninitialized transport in get_log_child if the import of the svn libraries had failed. 'convert' should never get as far as launching 'hg debugsvnlog' if the svn libraries are missing, but by launching a subprocess there is risk that the environment is mangled so the second import fails. It is in principle also possible to launch the command manually.

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