view contrib/showstack.py @ 28071:261324dd5f5b

merge: introduce method to minimize merge regions In the next diff, we will use this to trim down the start and end of conflict regions where the A and B sides both made the same changes.
author Ryan McElroy <rmcelroy@fb.com>
date Wed, 10 Feb 2016 08:25:03 -0800
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