Mercurial > hg
annotate tests/killdaemons.py @ 7654:816b708f23af
store all heads of a branch in the branch cache
All heads of branches will be stored in a new cache file 'branchheads.cache'
within the .hg directory. The old 'branch.cache' file from older versions
will be ignored.
The new cache contents are formatted line-by-line as '{node} {branchtag}\n'.
This is the same as the previous format. Now, every head is recorded in
an oldest -> tipmost order.
The localrepo.branchheads function is reworked to use the data from the cache.
author | John Mulligan <phlogistonjohn@asynchrono.us> |
---|---|
date | Wed, 14 Jan 2009 21:47:38 -0500 |
parents | 58fd3c718ca4 |
children | 3b76321aa0de |
rev | line source |
---|---|
7344
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
2 |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
3 import os, sys, time, errno, signal |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
4 |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
5 # Kill off any leftover daemon processes |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
6 try: |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
7 fp = file(os.environ['DAEMON_PIDS']) |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
8 for line in fp: |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
9 try: |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
10 pid = int(line) |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
11 except ValueError: |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
12 continue |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
13 try: |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
14 os.kill(pid, 0) |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
15 os.kill(pid, signal.SIGTERM) |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
16 for i in range(10): |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
17 time.sleep(0.05) |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
18 os.kill(pid, 0) |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
19 os.kill(pid, signal.SIGKILL) |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
20 except OSError, err: |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
21 if err.errno != errno.ESRCH: |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
22 raise |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
23 fp.close() |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
24 except IOError: |
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
25 pass |