Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlog.py @ 49778:45d7b8c380d7
changelog-v2: add a configuration to disable rank computation
We encountered a graph where rank computation was pathologically slow. We add an
option to disable this computation while this is getting fixed.
Disabling the rank computation should allow for testing other changelog-v2
features undisturbed (like changeset-based copy tracing).
I am purposely not adding a test for the new non-default code path, as this is
a temporary work around of an experimental feature.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 22 Nov 2022 12:44:22 +0100 |
parents | f5f113f1b011 |
children | 05db41701ece |
line wrap: on
line diff
--- a/mercurial/revlog.py Mon Nov 21 15:04:19 2022 +0100 +++ b/mercurial/revlog.py Tue Nov 22 12:44:22 2022 +0100 @@ -365,6 +365,11 @@ self._srdensitythreshold = 0.50 self._srmingapsize = 262144 + # other optionnals features + + # might remove rank configuration once the computation has no impact + self._compute_rank = False + # Make copy of flag processors so each revlog instance can support # custom flags. self._flagprocessors = dict(flagutil.flagprocessors) @@ -406,6 +411,7 @@ if b'changelogv2' in opts and self.revlog_kind == KIND_CHANGELOG: new_header = CHANGELOGV2 + self._compute_rank = opts.get(b'changelogv2.compute-rank', True) elif b'revlogv2' in opts: new_header = REVLOGV2 elif b'revlogv1' in opts: @@ -2499,7 +2505,7 @@ sidedata_offset = 0 rank = RANK_UNKNOWN - if self._format_version == CHANGELOGV2: + if self._compute_rank: if (p1r, p2r) == (nullrev, nullrev): rank = 1 elif p1r != nullrev and p2r == nullrev: