tests/readlink.py
author Raphaël Gomès <rgomes@octobus.net>
Tue, 05 Apr 2022 10:55:28 +0200
branchstable
changeset 48827 fbc02ccc207e
parent 45849 c102b704edb5
child 48966 6000f5b25c9b
permissions -rwxr-xr-x
rust-dirstatemap: properly decrement counter for tracked descendants I found this bug when writing unit tests after the fact for the `DirstateMap`. We never decremented the tracked descendants counter since we were always resetting the node data before reading it. This also drops the use of `state`, in favor of the new API to get that information. Differential Revision: https://phab.mercurial-scm.org/D12431

#!/usr/bin/env python3

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)