contrib/showstack.py
author Gregory Szorc <gregory.szorc@gmail.com>
Thu, 16 Mar 2017 12:23:56 -0700
branchstable
changeset 31473 ffed3bf5cd4c
parent 28522 f2fe7b199bb4
child 35656 c9eb92fb87b7
permissions -rw-r--r--
exchange: reject new compression engines for v1 bundles (issue5506) Version 1 bundles only support a fixed set of compression engines. Before this change, we would accept any compression engine for v1 bundles, even those that may not work on v1. This could lead to an error. We define a fixed set of compression engines known to work with v1 bundles and we add checking to ensure a newer engine (like zstd) won't work with v1 bundles. I also took the liberty of adding test coverage for unknown compression names because I noticed we didn't have coverage of it before.

# 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