Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 51398:e2dfa403452d
debug: add a debug::unbundle command that simulate the unbundle from a push
The code have different behavior when the unbundle comes from a push, so we
introduce a command that can simulate such unbundle.
For our copy of mozilla-try-2023-03-22, this make the unbundle jump from 2.5
seconds (with `hg unbundle`) to 15 seconds (with `hg debug::unbundle`).
That 15 seconds timings is consistent with the issue seen in production.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 23 Feb 2024 04:26:03 +0100 |
parents | 39f349391898 |
children | 15e680a44502 |
comparison
equal
deleted
inserted
replaced
51397:e9304c39e075 | 51398:e2dfa403452d |
---|---|
4075 ui, repo, run=run, optimize=set(optimize), backup=backup, **opts | 4075 ui, repo, run=run, optimize=set(optimize), backup=backup, **opts |
4076 ) | 4076 ) |
4077 | 4077 |
4078 | 4078 |
4079 @command( | 4079 @command( |
4080 b'debug::unbundle', | |
4081 [ | |
4082 ( | |
4083 b'u', | |
4084 b'update', | |
4085 None, | |
4086 _(b'update to new branch head if changesets were unbundled'), | |
4087 ) | |
4088 ], | |
4089 _(b'[-u] FILE...'), | |
4090 helpcategory=command.CATEGORY_IMPORT_EXPORT, | |
4091 ) | |
4092 def debugunbundle(ui, repo, *args, **kwargs): | |
4093 """same as `hg unbundle`, but pretent to come from a push | |
4094 | |
4095 This is useful to debug behavior and performance change in this case. | |
4096 """ | |
4097 from . import commands # avoid cycle | |
4098 | |
4099 unbundle = cmdutil.findcmd(b'unbundle', commands.table)[1][0] | |
4100 return unbundle(ui, repo, *args, _unbundle_source=b'push', **kwargs) | |
4101 | |
4102 | |
4103 @command( | |
4080 b'debugwalk', cmdutil.walkopts, _(b'[OPTION]... [FILE]...'), inferrepo=True | 4104 b'debugwalk', cmdutil.walkopts, _(b'[OPTION]... [FILE]...'), inferrepo=True |
4081 ) | 4105 ) |
4082 def debugwalk(ui, repo, *pats, **opts): | 4106 def debugwalk(ui, repo, *pats, **opts): |
4083 """show how files match on given patterns""" | 4107 """show how files match on given patterns""" |
4084 m = scmutil.match(repo[None], pats, pycompat.byteskwargs(opts)) | 4108 m = scmutil.match(repo[None], pats, pycompat.byteskwargs(opts)) |