diff mercurial/revlog.py @ 12011:f38b0a3308b6

deltaparent(): don't return nullrev for a revision containing a full snapshot this allows us to simplify manifest.readdelta and revlog.revdiff
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sat, 21 Aug 2010 19:30:42 +0200
parents 3361075816f8
children bade7a9c5c07
line wrap: on
line diff
--- a/mercurial/revlog.py	Sat Aug 21 10:48:49 2010 -0500
+++ b/mercurial/revlog.py	Sat Aug 21 19:30:42 2010 +0200
@@ -1018,16 +1018,14 @@
 
     def deltaparent(self, rev):
         """return previous revision or parentrev according to flags"""
-        if self.base(rev) == rev:
-            return nullrev
-        elif self.flags(rev) & REVIDX_PARENTDELTA:
+        if self.flags(rev) & REVIDX_PARENTDELTA:
             return self.parentrevs(rev)[0]
         else:
             return rev - 1
 
     def revdiff(self, rev1, rev2):
         """return or calculate a delta between two revisions"""
-        if rev1 != nullrev and self.deltaparent(rev2) == rev1:
+        if self.base(rev2) != rev2 and self.deltaparent(rev2) == rev1:
             return self._chunk(rev2)
 
         return mdiff.textdiff(self.revision(self.node(rev1)),