tests/readlink.py
author Laurent Charignon <lcharignon@fb.com>
Thu, 06 Aug 2015 22:11:20 -0700
changeset 26006 1ffd97cbf9a2
parent 25660 328739ea70c3
child 29175 7bcfb9090c86
permissions -rwxr-xr-x
reachableroots: default to the C implementation This patch is part of a series of patches to speed up the computation of revset.reachableroots by introducing a C implementation. The main motivation is to speed up smartlog on big repositories. At the end of the series, on our big repositories the computation of reachableroots is 10-50x faster and smartlog on is 2x-5x faster. Before this patch, reachableroots was computed in pure Python by default. This patch makes the C implementation the default and provides a speedup for reachableroots.

#!/usr/bin/env python

import errno, os, 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, 'not a symlink'

sys.exit(0)