Mercurial > hg
changeset 39149:f8db458651c8
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.
author | Paul Morelle <paul.morelle@octobus.net> |
---|---|
date | Fri, 20 Jul 2018 13:32:17 +0200 |
parents | 1464183343b3 |
children | f39efa885a6d |
files | mercurial/revlog.py |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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