# HG changeset patch # User mpm@selenic.com # Date 2005-05-21 01:40:24 # Node ID c7a66f9752a49487ff5f34ffad9705be02468616 # Parent a0e57df96e968d54fe7f9aa07c952bbba1bf9b1e Add code to retrieve or construct a revlog delta diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -188,6 +188,18 @@ class revlog: 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]