[Updated] D10799: revlog: add a ways to blacklist some revision when searching for a delta

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Jun 7 09:26:23 UTC 2021


Closed by commit rHG1efe3cdef53a: revlog: add a ways to blacklist some revision when searching for a delta (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10799?vs=28480&id=28502

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10799/new/

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

AFFECTED FILES
  mercurial/revlogutils/deltas.py

CHANGE DETAILS

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_bases=None):
         """Find an acceptable delta against a candidate revision
 
         revinfo: information about the revision (instance of _revisioninfo)
@@ -1062,10 +1062,17 @@
 
         If no suitable deltabase is found, we return delta info for a full
         snapshot.
+
+        `excluded_bases` is an optional set of revision that cannot be used as
+        a delta base. Use this to recompute delta suitable in censor or strip
+        context.
         """
         if not revinfo.textlen:
             return self._fullsnapshotinfo(fh, revinfo)
 
+        if excluded_bases is None:
+            excluded_bases = 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 +1097,8 @@
                 # challenge it against refined candidates
                 nominateddeltas.append(deltainfo)
             for candidaterev in candidaterevs:
+                if candidaterev in excluded_bases:
+                    continue
                 candidatedelta = self._builddeltainfo(revinfo, candidaterev, fh)
                 if candidatedelta is not None:
                     if isgooddeltainfo(self.revlog, candidatedelta, revinfo):



To: marmoute, #hg-reviewers, Alphare
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210607/107207ca/attachment.html>


More information about the Mercurial-patches mailing list