revlog: add a method to tells whether rev is stored as a snapshot
authorPaul Morelle <paul.morelle@octobus.net>
Fri, 20 Jul 2018 13:32:17 +0200
changeset 39149 f8db458651c8
parent 39148 1464183343b3
child 39150 f39efa885a6d
revlog: add a method to tells whether rev is stored as a snapshot For now we only have one type of snapshot: full snapshot versus nullrev. However we are looking into adding intermediate snapshot where a large diff against another snapshot is performed instead of storing a full new text. The conditional is a bit strange and is done in order to help readability of a some later changesets.
mercurial/revlog.py
--- a/mercurial/revlog.py	Wed Aug 15 15:20:44 2018 +0200
+++ b/mercurial/revlog.py	Fri Jul 20 13:32:17 2018 +0200
@@ -2095,6 +2095,16 @@
         else:
             return rev - 1
 
+    def issnapshot(self, rev):
+        """tells whether rev is a snapshot
+        """
+        if rev == nullrev:
+            return True
+        deltap = self.deltaparent(rev)
+        if deltap == nullrev:
+            return True
+        return False
+
     def revdiff(self, rev1, rev2):
         """return or calculate a delta between two revisions