Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlogutils/deltas.py @ 49879:bcae90c53def
delta-find: add a delta-reuse policy that blindly accepts incoming deltas
When this policy is set, incoming deltas are blindly accepted without regard
for the validity of the chain they build.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 07 Nov 2022 22:30:30 -0500 |
parents | c261a628e525 |
children | d57b966cdeb1 |
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py Sat Dec 03 01:24:34 2022 +0100 +++ b/mercurial/revlogutils/deltas.py Mon Nov 07 22:30:30 2022 -0500 @@ -20,6 +20,7 @@ COMP_MODE_DEFAULT, COMP_MODE_INLINE, COMP_MODE_PLAIN, + DELTA_BASE_REUSE_FORCE, DELTA_BASE_REUSE_NO, KIND_CHANGELOG, KIND_FILELOG, @@ -584,6 +585,13 @@ if deltainfo is None: return False + if ( + revinfo.cachedelta is not None + and deltainfo.base == revinfo.cachedelta[0] + and revinfo.cachedelta[2] == DELTA_BASE_REUSE_FORCE + ): + return True + # - 'deltainfo.distance' is the distance from the base revision -- # bounding it limits the amount of I/O we need to do. # - 'deltainfo.compresseddeltalen' is the sum of the total size of @@ -711,6 +719,16 @@ # filter out revision we tested already if rev in tested: continue + + if ( + cachedelta is not None + and rev == cachedelta[0] + and cachedelta[2] == DELTA_BASE_REUSE_FORCE + ): + # instructions are to forcibly consider/use this delta base + group.append(rev) + continue + # an higher authority deamed the base unworthy (e.g. censored) if excluded_bases is not None and rev in excluded_bases: tested.add(rev)