ui: add an uninterruptable context manager that can block SIGINT...
ui: add an uninterruptable context manager that can block SIGINT
The blocking of SIGINT is not done by default, but my hope is that we
will one day. This was inspired by Facebook's "nointerrupt" extension,
which is a bit more heavy-handed than this (whole commands are treated
as unsafe to interrupt). A future patch will enable this for varying
bits of Mercurial that are performing unsafe operations.
It's intentional that the KeyboardInterrupt is raised as the context
manager exits: during the span of the context manager interrupting
Mercurial could lead to data loss, but typically those spans are
fairly narrow, so we can let the unsafe block complete and then
terminate hg (which will leave the repo in a consistent state, even if
it's not the user's desired state).
.. api::
New context manager ``ui.uninterruptable()`` to mark portions of a command
as potentially unsafe places to interrupt Mercurial with Control-C or
similar.
Differential Revision:
https://phab.mercurial-scm.org/D3716