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.
--- 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