revlog: compute correct deltaparent in the deltaparent function
It now returns nullrev for chain base revisions, since they are conceptually
deltas against nullrev. The revdiff function was updated accordingly.
--- a/mercurial/manifest.py Thu May 05 11:33:02 2011 -0400
+++ b/mercurial/manifest.py Thu May 05 18:05:24 2011 +0200
@@ -41,7 +41,8 @@
def readfast(self, node):
'''use the faster of readdelta or read'''
r = self.rev(node)
- if self.deltaparent(r) in self.parentrevs(r):
+ deltaparent = self.deltaparent(r)
+ if deltaparent != revlog.nullrev and deltaparent in self.parentrevs(r):
return self.readdelta(node)
return self.read(node)
--- a/mercurial/revlog.py Thu May 05 11:33:02 2011 -0400
+++ b/mercurial/revlog.py Thu May 05 18:05:24 2011 +0200
@@ -830,11 +830,14 @@
def deltaparent(self, rev):
"""return deltaparent of the given revision"""
- return rev - 1
+ if self.index[rev][3] == rev:
+ return nullrev
+ else:
+ return rev - 1
def revdiff(self, rev1, rev2):
"""return or calculate a delta between two revisions"""
- if self.base(rev2) != rev2 and self.deltaparent(rev2) == rev1:
+ if rev1 != nullrev and self.deltaparent(rev2) == rev1:
return self._chunk(rev2)
return mdiff.textdiff(self.revision(self.node(rev1)),