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

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Wed Jun 2 03:19:00 UTC 2021


baymax added a comment.
baymax updated this revision to Diff 28409.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

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

BRANCH
  default

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/20210602/25ce9928/attachment.html>


More information about the Mercurial-patches mailing list