equal
deleted
inserted
replaced
258 t.append(bin[pos:pos + l]) |
258 t.append(bin[pos:pos + l]) |
259 pos += l |
259 pos += l |
260 return "".join(t) |
260 return "".join(t) |
261 |
261 |
262 def patch(a, bin): |
262 def patch(a, bin): |
|
263 if len(a) == 0: |
|
264 # skip over trivial delta header |
|
265 return buffer(bin, 12) |
263 return mpatch.patches(a, [bin]) |
266 return mpatch.patches(a, [bin]) |
264 |
267 |
265 # similar to difflib.SequenceMatcher.get_matching_blocks |
268 # similar to difflib.SequenceMatcher.get_matching_blocks |
266 def get_matching_blocks(a, b): |
269 def get_matching_blocks(a, b): |
267 return [(d[0], d[2], d[1] - d[0]) for d in bdiff.blocks(a, b)] |
270 return [(d[0], d[2], d[1] - d[0]) for d in bdiff.blocks(a, b)] |