comparison contrib/perf.py @ 49562:27bff60887fe stable

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 16 Oct 2022 04:48:21 +0200
parents 220738a53d05
children ec8140c44b14
comparison
equal deleted inserted replaced
49561:220738a53d05 49562:27bff60887fe
2674 ) 2674 )
2675 def perf_unbundle(ui, repo, fname, **opts): 2675 def perf_unbundle(ui, repo, fname, **opts):
2676 """benchmark application of a bundle in a repository. 2676 """benchmark application of a bundle in a repository.
2677 2677
2678 This does not include the final transaction processing""" 2678 This does not include the final transaction processing"""
2679
2679 from mercurial import exchange 2680 from mercurial import exchange
2680 from mercurial import bundle2 2681 from mercurial import bundle2
2681 2682 from mercurial import transaction
2682 opts = _byteskwargs(opts) 2683
2683 2684 opts = _byteskwargs(opts)
2684 if True: 2685
2686 ### some compatibility hotfix
2687 #
2688 # the data attribute is dropped in 63edc384d3b7 a changeset introducing a
2689 # critical regression that break transaction rollback for files that are
2690 # de-inlined.
2691 method = transaction.transaction._addentry
2692 pre_63edc384d3b7 = "data" in getargspec(method).args
2693 # the `detailed_exit_code` attribute is introduced in 33c0c25d0b0f
2694 # a changeset that is a close descendant of 18415fc918a1, the changeset
2695 # that conclude the fix run for the bug introduced in 63edc384d3b7.
2696 args = getargspec(error.Abort.__init__).args
2697 post_18415fc918a1 = "detailed_exit_code" in args
2698
2699 old_max_inline = None
2700 try:
2701 if not (pre_63edc384d3b7 or post_18415fc918a1):
2702 # disable inlining
2703 old_max_inline = mercurial.revlog._maxinline
2704 # large enough to never happen
2705 mercurial.revlog._maxinline = 2 ** 50
2706
2685 with repo.lock(): 2707 with repo.lock():
2686 bundle = [None, None] 2708 bundle = [None, None]
2687 orig_quiet = repo.ui.quiet 2709 orig_quiet = repo.ui.quiet
2688 try: 2710 try:
2689 repo.ui.quiet = True 2711 repo.ui.quiet = True
2719 finally: 2741 finally:
2720 repo.ui.quiet == orig_quiet 2742 repo.ui.quiet == orig_quiet
2721 gen, tr = bundle 2743 gen, tr = bundle
2722 if tr is not None: 2744 if tr is not None:
2723 tr.abort() 2745 tr.abort()
2746 finally:
2747 if old_max_inline is not None:
2748 mercurial.revlog._maxinline = old_max_inline
2724 2749
2725 2750
2726 @command( 2751 @command(
2727 b'perf::unidiff|perfunidiff', 2752 b'perf::unidiff|perfunidiff',
2728 revlogopts 2753 revlogopts