##// END OF EJS Templates
phases: large rewrite on retract boundary...
phases: large rewrite on retract boundary The new code is still pure Python, so we still have room to going significantly faster. However its complexity of the complex part is `O(|[min_new_draft, tip]|)` instead of `O(|[min_draft, tip]|` which should help tremendously one repository with old draft (like mercurial-devel or mozilla-try). This is especially useful as the most common "retract boundary" operation happens when we commit/rewrite new drafts or when we push new draft to a non-publishing server. In this case, the smallest new_revs is very close to the tip and there is very few work to do. A few smaller optimisation could be done for these cases and will be introduced in later changesets. We still have iterate over large sets of roots, but this is already a great improvement for a very small amount of work. We gather information on the affected changeset as we go as we can put it to use in the next changesets. This extra data collection might slowdown the `register_new` case a bit, however for register_new, it should not really matters. The set of new nodes is either small, so the impact is negligible, or the set of new nodes is large, and the amount of work to do to had them will dominate the overhead the collecting information in `changed_revs`. As this new code compute the changes on the fly, it unlock other interesting improvement to be done in later changeset.

File last commit:

r51882:752c5a5b default
r52302:2f39c7ae default
Show More
admin_commands.py
49 lines | 1.5 KiB | text/x-python | PythonLexer
# 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.
from .i18n import _
from .admin import verify
from . import error, registrar, transaction
table = {}
command = registrar.command(table)
@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:
ui.warn(_(b"found %d errors\n") % len(errors))