diff mercurial/debugcommands.py @ 51593: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
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Wed Mar 27 17:29:48 2024 +0000
+++ b/mercurial/debugcommands.py	Wed Mar 27 17:46:23 2024 +0000
@@ -4078,26 +4078,17 @@
 
 @command(
     b'debug::unbundle',
-    [
-        (
-            b'u',
-            b'update',
-            None,
-            _(b'update to new branch head if changesets were unbundled'),
-        )
-    ],
-    _(b'[-u] FILE...'),
+    [],
+    _(b'FILE...'),
     helpcategory=command.CATEGORY_IMPORT_EXPORT,
 )
-def debugunbundle(ui, repo, *args, **kwargs):
+def debugunbundle(ui, repo, fname1, *fnames):
     """same as `hg unbundle`, but pretent to come from a push
 
     This is useful to debug behavior and performance change in this case.
     """
-    from . import commands  # avoid cycle
-
-    unbundle = cmdutil.findcmd(b'unbundle', commands.table)[1][0]
-    return unbundle(ui, repo, *args, _unbundle_source=b'push', **kwargs)
+    fnames = (fname1,) + fnames
+    cmdutil.unbundle_files(ui, repo, fnames)
 
 
 @command(