comparison mercurial/debugcommands.py @ 51552:15e680a44502

unbundle: move most of the logic on cmdutil to help debug::unbundle reuse This make sure `hg debug::unbundle` focus on the core logic.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 27 Mar 2024 17:46:23 +0000
parents e2dfa403452d
children b08de326bee4
comparison
equal deleted inserted replaced
51551:a151fd01e98c 51552:15e680a44502
4076 ) 4076 )
4077 4077
4078 4078
4079 @command( 4079 @command(
4080 b'debug::unbundle', 4080 b'debug::unbundle',
4081 [ 4081 [],
4082 ( 4082 _(b'FILE...'),
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, 4083 helpcategory=command.CATEGORY_IMPORT_EXPORT,
4091 ) 4084 )
4092 def debugunbundle(ui, repo, *args, **kwargs): 4085 def debugunbundle(ui, repo, fname1, *fnames):
4093 """same as `hg unbundle`, but pretent to come from a push 4086 """same as `hg unbundle`, but pretent to come from a push
4094 4087
4095 This is useful to debug behavior and performance change in this case. 4088 This is useful to debug behavior and performance change in this case.
4096 """ 4089 """
4097 from . import commands # avoid cycle 4090 fnames = (fname1,) + fnames
4098 4091 cmdutil.unbundle_files(ui, repo, fnames)
4099 unbundle = cmdutil.findcmd(b'unbundle', commands.table)[1][0]
4100 return unbundle(ui, repo, *args, _unbundle_source=b'push', **kwargs)
4101 4092
4102 4093
4103 @command( 4094 @command(
4104 b'debugwalk', cmdutil.walkopts, _(b'[OPTION]... [FILE]...'), inferrepo=True 4095 b'debugwalk', cmdutil.walkopts, _(b'[OPTION]... [FILE]...'), inferrepo=True
4105 ) 4096 )