debug: add a config to abort update early
authorArseniy Alekseyev <aalekseyev@janestreet.com>
Fri, 06 Jan 2023 16:01:31 +0000
changeset 49883 becd16690cbe
parent 49882 8c7895db8955
child 49884 44deb5a164dc
debug: add a config to abort update early This is useful to benchmark the parts of [hg update] that come before the parallel worker.
mercurial/configitems.py
mercurial/merge.py
--- a/mercurial/configitems.py	Wed Jan 11 16:51:37 2023 +0400
+++ b/mercurial/configitems.py	Fri Jan 06 16:01:31 2023 +0000
@@ -746,6 +746,14 @@
     b'discovery.exchange-heads',
     default=True,
 )
+# If devel.debug.abort-update is True, then any merge with the working copy,
+# e.g. [hg update], will be aborted after figuring out what needs to be done,
+# but before spawning the parallel worker
+coreconfigitem(
+    b'devel',
+    b'debug.abort-update',
+    default=False,
+)
 # If discovery.grow-sample is False, the sample size used in set discovery will
 # not be increased through the process
 coreconfigitem(
--- a/mercurial/merge.py	Wed Jan 11 16:51:37 2023 +0400
+++ b/mercurial/merge.py	Fri Jan 06 16:01:31 2023 +0000
@@ -1142,6 +1142,8 @@
             followcopies,
         )
         _checkunknownfiles(repo, wctx, mctx, force, mresult, mergeforce)
+        if repo.ui.configbool(b'devel', b'debug.abort-update'):
+            exit(1)
 
     else:  # only when merge.preferancestor=* - the default
         repo.ui.note(