mirror of
https://github.com/facebook/sapling.git
synced 2025-01-06 04:43:19 +03:00
Add a function to return the new text from a binary diff
This commit is contained in:
parent
ea4eabe690
commit
4e35c669ab
@ -53,6 +53,16 @@ def diff(a, b, sorted=0):
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user