changeset 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 ce818cf215dc
children bade7a9c5c07
files mercurial/manifest.py mercurial/revlog.py
diffstat 2 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/manifest.py	Sat Aug 21 10:48:49 2010 -0500
+++ b/mercurial/manifest.py	Sat Aug 21 19:30:42 2010 +0200
@@ -36,9 +36,7 @@
 
     def readdelta(self, node):
         r = self.rev(node)
-        if self._parentdelta:
-            return self.parse(mdiff.patchtext(self.revdiff(self.deltaparent(r), r)))
-        return self.parse(mdiff.patchtext(self.revdiff(r - 1, r)))
+        return self.parse(mdiff.patchtext(self.revdiff(self.deltaparent(r), r)))
 
     def read(self, node):
         if node == revlog.nullid:
--- 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)),