# HG changeset patch # User Sune Foldager # Date 2011-05-05 16:05:24 # Node ID d62d597b8974574686b13dfb2f2c97500fa9212f # Parent c1cca38818b92564ade9283994c5964f9d1e59d9 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. diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -41,7 +41,8 @@ class manifest(revlog.revlog): 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) diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -830,11 +830,14 @@ class revlog(object): 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)),