diff mercurial/revlog.py @ 49490:5846bc8a2855

revlog: finer computation of "issnapshot" If the parent had an empty diff, we skip of it to compute a diff against the parent base. This create shorter and simpler chain. However these case could be wrongly detected as snapshot. So we improve the code doing this detection. In practice nobody care as when tried on a copy of mozilla-try and we got the same number of snapshot (1315) in both case. Performance where equivalent.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 20 May 2022 11:02:52 +0100
parents 5fe7e9eda0f3
children 8d6c8a9a91f8
line wrap: on
line diff
--- a/mercurial/revlog.py	Fri Aug 26 00:50:31 2022 +0200
+++ b/mercurial/revlog.py	Fri May 20 11:02:52 2022 +0100
@@ -1775,7 +1775,17 @@
         if base == nullrev:
             return True
         p1 = entry[5]
+        while self.length(p1) == 0:
+            b = self.deltaparent(p1)
+            if b == p1:
+                break
+            p1 = b
         p2 = entry[6]
+        while self.length(p2) == 0:
+            b = self.deltaparent(p2)
+            if b == p2:
+                break
+            p2 = b
         if base == p1 or base == p2:
             return False
         return self.issnapshot(base)