Mercurial > hg
view contrib/showstack.py @ 28276:b4ceadb2c439
chgserver: add utilities to calculate mtimehash
mtimehash is designed to detect file changes. These files include:
- single file extensions (__init__.py for complex extensions)
- mercurial/__version__.py
- python (sys.executable)
mtimehash only uses stat to check files so it's fast but not 100% accurate.
However it should be good enough for our use case.
For chgserver, once mtimehash changes, the server is considered outdated
immediately and should no longer provide service.
author | Jun Wu <quark@fb.com> |
---|---|
date | Fri, 26 Feb 2016 14:59:39 +0000 |
parents | bdac264e5ed4 |
children | f2fe7b199bb4 |
line wrap: on
line source
# showstack.py - extension to dump a Python stack trace on signal # # binds to both SIGQUIT (Ctrl-\) and SIGINFO (Ctrl-T on BSDs) import sys, signal, traceback def sigshow(*args): sys.stderr.write("\n") traceback.print_stack(args[1], limit=10, file=sys.stderr) sys.stderr.write("----\n") def extsetup(ui): signal.signal(signal.SIGQUIT, sigshow) try: signal.signal(signal.SIGINFO, sigshow) except AttributeError: pass