Mercurial > hg
view contrib/showstack.py @ 46587:cb4b0b0c6de4
copies-rust: split up combine_changeset_copies function into a struct
… such that each iteration of its former loop is now a method call,
with the caller driving the loop.
This entirely removes the need for the `DataHolder` hack:
the method now takes a `ChangedFiles<'_>` parameter that borrows
a bytes buffer that can be owned by the caller’s stack frame,
just for the duration of that call.
Differential Revision: https://phab.mercurial-scm.org/D9683
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Tue, 05 Jan 2021 21:02:00 +0100 |
parents | 2372284d9457 |
children | 6000f5b25c9b |
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) r"""dump stack trace when receiving SIGQUIT (Ctrl-\) or SIGINFO (Ctrl-T on BSDs) """ from __future__ import absolute_import, print_function 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 sigexit(*args): sigshow(*args) print('alarm!') sys.exit(1) def extsetup(ui): signal.signal(signal.SIGQUIT, sigshow) signal.signal(signal.SIGALRM, sigexit) try: signal.signal(signal.SIGINFO, sigshow) except AttributeError: pass