Mercurial > hg-stable
changeset 119:c7a66f9752a4
Add code to retrieve or construct a revlog delta
author | mpm@selenic.com |
---|---|
date | Fri, 20 May 2005 17:40:24 -0800 |
parents | a0e57df96e96 |
children | bae6f0328f63 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Fri May 20 17:38:01 2005 -0800 +++ b/mercurial/revlog.py Fri May 20 17:40:24 2005 -0800 @@ -188,6 +188,18 @@ def patches(self, t, pl): return mdiff.patches(t, pl) + def delta(self, node): + r = self.rev(node) + b = self.base(r) + if r == b: + return self.diff(self.revision(self.node(r - 1)), + self.revision(node)) + else: + f = self.opener(self.datafile) + f.seek(self.start(r)) + data = f.read(self.length(r)) + return decompress(data) + def revision(self, node): if node == nullid: return "" if self.cache and self.cache[0] == node: return self.cache[2]