Patchwork D10799: revlog: add a ways to blacklist some revision when searching for a delta

login
register
mail settings
Submitter phabricator
Date May 30, 2021, 5:31 p.m.
Message ID <differential-rev-PHID-DREV-f3aa56nrluljbiwtoqei-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49117/
State Superseded
Headers show

Comments

phabricator - May 30, 2021, 5:31 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will be useful to recompute appropriate deltas one the fly during
  censor/strip operation with revlog-v2.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10799

AFFECTED FILES
  mercurial/revlogutils/deltas.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py
+++ b/mercurial/revlogutils/deltas.py
@@ -1050,7 +1050,7 @@ 
             snapshotdepth,
         )
 
-    def finddeltainfo(self, revinfo, fh):
+    def finddeltainfo(self, revinfo, fh, excluded_base=None):
         """Find an acceptable delta against a candidate revision
 
         revinfo: information about the revision (instance of _revisioninfo)
@@ -1066,6 +1066,9 @@ 
         if not revinfo.textlen:
             return self._fullsnapshotinfo(fh, revinfo)
 
+        if excluded_base is None:
+            excluded_base = set()
+
         # no delta for flag processor revision (see "candelta" for why)
         # not calling candelta since only one revision needs test, also to
         # avoid overhead fetching flags again.
@@ -1090,6 +1093,8 @@ 
                 # challenge it against refined candidates
                 nominateddeltas.append(deltainfo)
             for candidaterev in candidaterevs:
+                if candidaterev in excluded_base:
+                    continue
                 candidatedelta = self._builddeltainfo(revinfo, candidaterev, fh)
                 if candidatedelta is not None:
                     if isgooddeltainfo(self.revlog, candidatedelta, revinfo):