tests/killdaemons.py
author Matt Mackall <mpm@selenic.com>
Wed, 04 Jan 2012 17:55:30 -0600
changeset 15775 91eb4512edd0
parent 10905 13a1b2fb7ef2
child 17464 eddfb9a550d0
permissions -rwxr-xr-x
copies: rewrite copy detection for non-merge users The existing copy detection API was designed with merge in mind and was ill-suited for doing status/diff. The new pathcopies implementation gives more accurate, easier to use results for comparing two revisions, and is much simpler to understand. Test notes: - test-mv-cp-st.t results finds more renames in the reverse direction now - test-mq-merge.t was always wrong and duplicated a copy in diff that was already present in one of the parent revisions

#!/usr/bin/env python

import os, time, errno, signal

# Kill off any leftover daemon processes
try:
    fp = open(os.environ['DAEMON_PIDS'])
    for line in fp:
        try:
            pid = int(line)
        except ValueError:
            continue
        try:
            os.kill(pid, 0)
            os.kill(pid, signal.SIGTERM)
            for i in range(10):
                time.sleep(0.05)
                os.kill(pid, 0)
            os.kill(pid, signal.SIGKILL)
        except OSError, err:
            if err.errno != errno.ESRCH:
                raise
    fp.close()
except IOError:
    pass