equal
deleted
inserted
replaced
50 if o == 'equal': continue |
50 if o == 'equal': continue |
51 s = "".join(b[s:t]) |
51 s = "".join(b[s:t]) |
52 bin.append(struct.pack(">lll", p[m], p[n], len(s)) + s) |
52 bin.append(struct.pack(">lll", p[m], p[n], len(s)) + s) |
53 |
53 |
54 return "".join(bin) |
54 return "".join(bin) |
|
55 |
|
56 def patchtext(bin): |
|
57 pos = 0 |
|
58 t = [] |
|
59 while pos < len(bin): |
|
60 p1, p2, l = struct.unpack(">lll", bin[pos:pos + 12]) |
|
61 pos += 12 |
|
62 t.append(bin[pos:pos + l]) |
|
63 pos += l |
|
64 return "".join(t) |
55 |
65 |
56 # This attempts to apply a series of patches in time proportional to |
66 # This attempts to apply a series of patches in time proportional to |
57 # the total size of the patches, rather than patches * len(text). This |
67 # the total size of the patches, rather than patches * len(text). This |
58 # means rather than shuffling strings around, we shuffle around |
68 # means rather than shuffling strings around, we shuffle around |
59 # pointers to fragments with fragment lists. |
69 # pointers to fragments with fragment lists. |