diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -923,6 +923,13 @@ coreconfigitem( b'changegroup4', default=False, ) + +# might remove rank configuration once the computation has no impact +coreconfigitem( + b'experimental', + b'changelog-v2.compute-rank', + default=True, +) coreconfigitem( b'experimental', b'cleanup-as-archived', diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1068,6 +1068,8 @@ def resolverevlogstorevfsoptions(ui, req options[b'revlogv2'] = True if requirementsmod.CHANGELOGV2_REQUIREMENT in requirements: options[b'changelogv2'] = True + cmp_rank = ui.configbool(b'experimental', b'changelog-v2.compute-rank') + options[b'changelogv2.compute-rank'] = cmp_rank if requirementsmod.GENERALDELTA_REQUIREMENT in requirements: options[b'generaldelta'] = True diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -365,6 +365,11 @@ class revlog: 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 @@ class revlog: 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 @@ class revlog: 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: