[Updated] [+ ] D10887: deltas: at a `target_rev` parameter to finddeltainfo
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Mon Jun 21 13:10:43 UTC 2021
marmoute updated this revision to Diff 28646.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D10887?vs=28616&id=28646
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D10887/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D10887
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
@@ -1033,8 +1033,7 @@
snapshotdepth,
)
- def _fullsnapshotinfo(self, fh, revinfo):
- curr = len(self.revlog)
+ def _fullsnapshotinfo(self, fh, revinfo, curr):
rawtext = self.buildtext(revinfo, fh)
data = self.revlog.compress(rawtext)
compresseddeltalen = deltalen = dist = len(data[1]) + len(data[0])
@@ -1053,7 +1052,7 @@
snapshotdepth,
)
- def finddeltainfo(self, revinfo, fh, excluded_bases=None):
+ def finddeltainfo(self, revinfo, fh, excluded_bases=None, target_rev=None):
"""Find an acceptable delta against a candidate revision
revinfo: information about the revision (instance of _revisioninfo)
@@ -1070,8 +1069,11 @@
a delta base. Use this to recompute delta suitable in censor or strip
context.
"""
+ if target_rev is None:
+ curr = len(self.revlog)
+
if not revinfo.textlen:
- return self._fullsnapshotinfo(fh, revinfo)
+ return self._fullsnapshotinfo(fh, revinfo, target_rev)
if excluded_bases is None:
excluded_bases = set()
@@ -1080,7 +1082,7 @@
# not calling candelta since only one revision needs test, also to
# avoid overhead fetching flags again.
if revinfo.flags & REVIDX_RAWTEXT_CHANGING_FLAGS:
- return self._fullsnapshotinfo(fh, revinfo)
+ return self._fullsnapshotinfo(fh, revinfo, target_rev)
cachedelta = revinfo.cachedelta
p1 = revinfo.p1
@@ -1102,6 +1104,8 @@
for candidaterev in candidaterevs:
if candidaterev in excluded_bases:
continue
+ if candidaterev >= target_rev:
+ continue
candidatedelta = self._builddeltainfo(revinfo, candidaterev, fh)
if candidatedelta is not None:
if isgooddeltainfo(self.revlog, candidatedelta, revinfo):
@@ -1114,7 +1118,7 @@
candidaterevs = next(groups)
if deltainfo is None:
- deltainfo = self._fullsnapshotinfo(fh, revinfo)
+ deltainfo = self._fullsnapshotinfo(fh, revinfo, target_rev)
return deltainfo
To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210621/f4de183d/attachment-0002.html>
More information about the Mercurial-patches
mailing list