Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/mdiff.py @ 5369:7530334bf301
revlog: generate trivial deltas against null revision
To avoid extra memory usage and performance issues with large files,
generate a trivial delta header for deltas against the null revision
rather than calling the usual delta generator.
We append the delta header to meta rather than prepending it to data
to avoid a large allocate and copy.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 03 Oct 2007 17:17:27 -0500 |
parents | 372d93f03d3a |
children |
comparison
equal
deleted
inserted
replaced
5368:ff32b2725651 | 5369:7530334bf301 |
---|---|
243 | 243 |
244 # similar to difflib.SequenceMatcher.get_matching_blocks | 244 # similar to difflib.SequenceMatcher.get_matching_blocks |
245 def get_matching_blocks(a, b): | 245 def get_matching_blocks(a, b): |
246 return [(d[0], d[2], d[1] - d[0]) for d in bdiff.blocks(a, b)] | 246 return [(d[0], d[2], d[1] - d[0]) for d in bdiff.blocks(a, b)] |
247 | 247 |
248 def trivialdiffheader(length): | |
249 return struct.pack(">lll", 0, 0, length) | |
250 | |
248 patches = mpatch.patches | 251 patches = mpatch.patches |
249 patchedsize = mpatch.patchedsize | 252 patchedsize = mpatch.patchedsize |
250 textdiff = bdiff.bdiff | 253 textdiff = bdiff.bdiff |