diff mercurial/commands.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 e9304c39e075
children f28d5d68b71a
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Feb 14 08:14:46 2024 +0100
+++ b/mercurial/commands.py	Fri Feb 23 04:26:03 2024 +0100
@@ -7730,7 +7730,7 @@
     _(b'[-u] FILE...'),
     helpcategory=command.CATEGORY_IMPORT_EXPORT,
 )
-def unbundle(ui, repo, fname1, *fnames, **opts):
+def unbundle(ui, repo, fname1, *fnames, _unbundle_source=b'unbundle', **opts):
     """apply one or more bundle files
 
     Apply one or more bundle files generated by :hg:`bundle`.
@@ -7758,7 +7758,11 @@
                     txnname = b'unbundle\n%s' % urlutil.hidepassword(url)
                 with repo.transaction(txnname) as tr:
                     op = bundle2.applybundle(
-                        repo, gen, tr, source=b'unbundle', url=url
+                        repo,
+                        gen,
+                        tr,
+                        source=_unbundle_source,  # used by debug::unbundle
+                        url=url,
                     )
             except error.BundleUnknownFeatureError as exc:
                 raise error.Abort(