Mercurial > public > mercurial-scm > hg-stable
diff mercurial/mdiff.py @ 120:bae6f0328f63
Add a function to return the new text from a binary diff
author | mpm@selenic.com |
---|---|
date | Fri, 20 May 2005 17:42:29 -0800 |
parents | b942bbe4bb84 |
children | 8913e13196e1 |
line wrap: on
line diff
--- a/mercurial/mdiff.py Fri May 20 17:40:24 2005 -0800 +++ b/mercurial/mdiff.py Fri May 20 17:42:29 2005 -0800 @@ -53,6 +53,16 @@ return "".join(bin) +def patchtext(bin): + pos = 0 + t = [] + while pos < len(bin): + p1, p2, l = struct.unpack(">lll", bin[pos:pos + 12]) + pos += 12 + t.append(bin[pos:pos + l]) + pos += l + return "".join(t) + # This attempts to apply a series of patches in time proportional to # the total size of the patches, rather than patches * len(text). This # means rather than shuffling strings around, we shuffle around