perf-unbundle: do a quick and dirty fix to make it run on more commit stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 16 Oct 2022 04:48:21 +0200
branchstable
changeset 49562 27bff60887fe
parent 49561 220738a53d05
child 49565 9dce3960735b
perf-unbundle: do a quick and dirty fix to make it run on more commit Without this change, the perf commands fails within the f67741e8264b::18415fc918a1 range (boundary excluded). Check inline comment for details. With this fix, the command is able to run on this range, with a slightly different behavior (as no revset is "uninlined"). However this is still much better than not being able to run anything in this range. Especially because that range do see some performance regression for unbundle.
contrib/perf.py
--- a/contrib/perf.py	Wed Oct 19 01:54:04 2022 +0200
+++ b/contrib/perf.py	Sun Oct 16 04:48:21 2022 +0200
@@ -2676,12 +2676,34 @@
     """benchmark application of a bundle in a repository.
 
     This does not include the final transaction processing"""
+
     from mercurial import exchange
     from mercurial import bundle2
+    from mercurial import transaction
 
     opts = _byteskwargs(opts)
 
-    if True:
+    ###  some compatibility hotfix
+    #
+    # the data attribute is dropped in 63edc384d3b7 a changeset introducing a
+    # critical regression that break transaction rollback for files that are
+    # de-inlined.
+    method = transaction.transaction._addentry
+    pre_63edc384d3b7 = "data" in getargspec(method).args
+    # the `detailed_exit_code` attribute is introduced in 33c0c25d0b0f
+    # a changeset that is a close descendant of 18415fc918a1, the changeset
+    # that conclude the fix run for the bug introduced in 63edc384d3b7.
+    args = getargspec(error.Abort.__init__).args
+    post_18415fc918a1 = "detailed_exit_code" in args
+
+    old_max_inline = None
+    try:
+        if not (pre_63edc384d3b7 or post_18415fc918a1):
+            # disable inlining
+            old_max_inline = mercurial.revlog._maxinline
+            # large enough to never happen
+            mercurial.revlog._maxinline = 2 ** 50
+
         with repo.lock():
             bundle = [None, None]
             orig_quiet = repo.ui.quiet
@@ -2721,6 +2743,9 @@
                 gen, tr = bundle
                 if tr is not None:
                     tr.abort()
+    finally:
+        if old_max_inline is not None:
+            mercurial.revlog._maxinline = old_max_inline
 
 
 @command(