view contrib/showstack.py @ 34826:18a3274ed675

configitems: register the full 'merge-tools' config and sub-options We register the merge-tools config section (which has an arbitrary base config value) and the possible sub-attribute. The sub-attribute has to be registered first or at the same time otherwise the '.*' item would shadow them. Merge tools could include "." in their name so we can't constrain any more than just ".*".
author Boris Feld <boris.feld@octobus.net>
date Sun, 08 Oct 2017 20:37:13 +0200
parents f2fe7b199bb4
children c9eb92fb87b7
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)

from __future__ import absolute_import
import signal
import sys
import 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