diff mercurial/revlog.py @ 39120:8f83a953dddf

revlog: skip over empty revision when looking for delta base There is no point in keeping an empty revision in the middle of a chain since they won't contribute any data. So we filter them out when looking for a valid base delta.
author Boris Feld <boris.feld@octobus.net>
date Fri, 27 Jul 2018 19:09:41 +0200
parents 18e866ae2a7d
children 152ae0f84f9a
line wrap: on
line diff
--- a/mercurial/revlog.py	Sat Jul 28 14:14:59 2018 +0200
+++ b/mercurial/revlog.py	Fri Jul 27 19:09:41 2018 +0200
@@ -743,10 +743,20 @@
         p2 = revinfo.p2
         revlog = self.revlog
 
+        deltalength = self.revlog.length
+        deltaparent = self.revlog.deltaparent
+
         deltainfo = None
         for candidaterevs in self._getcandidaterevs(p1, p2, cachedelta):
             nominateddeltas = []
             for candidaterev in candidaterevs:
+                # skip over empty delta (no need to include them in a chain)
+                while candidaterev != nullrev and not deltalength(candidaterev):
+                    candidaterev = deltaparent(candidaterev)
+                # no need to try a delta against nullid, this will be handled
+                # by fulltext later.
+                if candidaterev == nullrev:
+                    continue
                 # no delta for rawtext-changing revs (see "candelta" for why)
                 if revlog.flags(candidaterev) & REVIDX_RAWTEXT_CHANGING_FLAGS:
                     continue