Mercurial > hg
changeset 35639:30f5f33250c8
revlog: separate diff computation from the collection of other info
author | Paul Morelle <paul.morelle@octobus.net> |
---|---|
date | Sun, 14 Jan 2018 12:59:46 -0800 |
parents | edc9330acac1 |
children | fa4278171add |
files | mercurial/revlog.py |
diffstat | 1 files changed, 15 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Fri Jan 12 18:58:44 2018 +0100 +++ b/mercurial/revlog.py Sun Jan 14 12:59:46 2018 -0800 @@ -1935,20 +1935,26 @@ raise return btext[0] + def _builddeltadiff(self, base, node, p1, p2, btext, cachedelta, fh, flags): + t = self._buildtext(node, p1, p2, btext, cachedelta, fh, flags) + if self.iscensored(base): + # deltas based on a censored revision must replace the + # full content in one patch, so delta works everywhere + header = mdiff.replacediffheader(self.rawsize(base), len(t)) + delta = header + t + else: + ptext = self.revision(base, _df=fh, raw=True) + delta = mdiff.textdiff(ptext, t) + + return delta + def _builddeltainfo(self, node, rev, p1, p2, btext, cachedelta, fh, flags): # can we use the cached delta? if cachedelta and cachedelta[0] == rev: delta = cachedelta[1] else: - t = self._buildtext(node, p1, p2, btext, cachedelta, fh, flags) - if self.iscensored(rev): - # deltas based on a censored revision must replace the - # full content in one patch, so delta works everywhere - header = mdiff.replacediffheader(self.rawsize(rev), len(t)) - delta = header + t - else: - ptext = self.revision(rev, _df=fh, raw=True) - delta = mdiff.textdiff(ptext, t) + delta = self._builddeltadiff(rev, node, p1, p2, btext, cachedelta, + fh, flags) header, data = self.compress(delta) deltalen = len(header) + len(data) chainbase = self.chainbase(rev)