Mercurial > hg
annotate contrib/showstack.py @ 29387:6b77adc2c7b5
hgweb: highlight data of the current revision in annotate view
* Distinguish the /annotate/<revision>/<file>#<linenumber> link when it would
lead to the current page (i.e. <revision> is the current revision) (style it
gray and undecorated). This indicates more clearly that this is a "dead-end"
in blame navigation.
* Display lines changed in current revision in green.
author | Denis Laxalde <denis.laxalde@logilab.fr> |
---|---|
date | Thu, 02 Jun 2016 16:26:50 +0200 |
parents | f2fe7b199bb4 |
children | c9eb92fb87b7 |
rev | line source |
---|---|
26123
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
1 # showstack.py - extension to dump a Python stack trace on signal |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
2 # |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
3 # binds to both SIGQUIT (Ctrl-\) and SIGINFO (Ctrl-T on BSDs) |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
4 |
28522
f2fe7b199bb4
showstack: use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
26123
diff
changeset
|
5 from __future__ import absolute_import |
f2fe7b199bb4
showstack: use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
26123
diff
changeset
|
6 import signal |
f2fe7b199bb4
showstack: use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
26123
diff
changeset
|
7 import sys |
f2fe7b199bb4
showstack: use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
26123
diff
changeset
|
8 import traceback |
26123
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
9 |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
10 def sigshow(*args): |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
11 sys.stderr.write("\n") |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
12 traceback.print_stack(args[1], limit=10, file=sys.stderr) |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
13 sys.stderr.write("----\n") |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
14 |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
15 def extsetup(ui): |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
16 signal.signal(signal.SIGQUIT, sigshow) |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
17 try: |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
18 signal.signal(signal.SIGINFO, sigshow) |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
19 except AttributeError: |
bdac264e5ed4
contrib: add showstack extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
20 pass |