##// END OF EJS Templates
tests: add a module that can perform the equivalent of `SIGKILL` on any OS...
tests: add a module that can perform the equivalent of `SIGKILL` on any OS I started with this being Windows specific, but let's push all of the decision making into this function so that it can just be called by the tests. The tradeoff is that this is very specific to sending `SIGKILL`- since `signal.SIGKILL` doesn't exist on Windows, the desired signal can't be passed from the caller. Maybe there's a way, but let's wait until there's a need. We don't use `killdaemons.py` unconditionally because it starts with a more graceful `SIGTERM` on posix.

File last commit:

r52757:1c5810ce default
r52889:625cf962 default
Show More
admin_commands.py
52 lines | 1.6 KiB | text/x-python | PythonLexer
Franck Bret
commands: add admin namespace...
r51880 # admin_commands.py - command processing for admin* commands
#
# Copyright 2022 Mercurial Developers
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
Matt Harbison
typing: add `from __future__ import annotations` to remaining source files...
r52757 from __future__ import annotations
Raphaël Gomès
admin-command: add verify command...
r51882 from .i18n import _
Raphaël Gomès
admin-commands: move the chainsaw extension to the admin commands module...
r52396 from .admin import chainsaw, verify
Raphaël Gomès
admin-command: add verify command...
r51882 from . import error, registrar, transaction
Franck Bret
commands: add admin namespace...
r51880
table = {}
Raphaël Gomès
admin-commands: move the chainsaw extension to the admin commands module...
r52396 table.update(chainsaw.command._table)
Franck Bret
commands: add admin namespace...
r51880 command = registrar.command(table)
Raphaël Gomès
admin-command: add verify command...
r51882
@command(
b'admin::verify',
[
(b'c', b'check', [], _(b'add a check'), _(b'CHECK')),
(b'o', b'option', [], _(b'pass an option to a check'), _(b'OPTION')),
],
helpcategory=command.CATEGORY_MAINTENANCE,
)
def admin_verify(ui, repo, **opts):
"""verify the integrity of the repository
Alternative UI to `hg verify` with a lot more control over the
verification process and better error reporting.
"""
if not repo.url().startswith(b'file:'):
raise error.Abort(_(b"cannot verify bundle or remote repos"))
if transaction.has_abandoned_transaction(repo):
ui.warn(_(b"abandoned transaction found - run hg recover\n"))
checks = opts.get("check", [])
options = opts.get("option", [])
funcs = verify.get_checks(repo, ui, names=checks, options=options)
ui.status(_(b"running %d checks\n") % len(funcs))
# Done in two times so the execution is separated from the resolving step
for name, func in sorted(funcs.items(), key=lambda x: x[0]):
ui.status(_(b"running %s\n") % name)
errors = func()
if errors:
Raphaël Gomès
admin-verify: expect a number of errors to be returned...
r52508 ui.warn(_(b"found %d errors\n") % errors)