Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/patch.py @ 4104:ed46895aa38c
git binary patches: use hashes to detect identical files
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 17 Feb 2007 09:54:59 -0200 |
parents | 4ced663bebf0 |
children | 797dbdd4d7e1 |
comparison
equal
deleted
inserted
replaced
4103:0934fef871f3 | 4104:ed46895aa38c |
---|---|
410 i = 0 | 410 i = 0 |
411 while i < l: | 411 while i < l: |
412 yield text[i:i+csize] | 412 yield text[i:i+csize] |
413 i += csize | 413 i += csize |
414 | 414 |
415 if to == tn: | 415 tohash = gitindex(to) |
416 tnhash = gitindex(tn) | |
417 if tohash == tnhash: | |
416 return | 418 return |
417 # TODO: deltas | 419 # TODO: deltas |
418 l = len(tn) | |
419 fp.write('index %s..%s\nGIT binary patch\nliteral %s\n' % | 420 fp.write('index %s..%s\nGIT binary patch\nliteral %s\n' % |
420 (gitindex(to), gitindex(tn), len(tn))) | 421 (tohash, tnhash, len(tn))) |
421 | 422 |
422 tn = ''.join([fmtline(l) for l in chunk(zlib.compress(tn))]) | 423 tn = ''.join([fmtline(l) for l in chunk(zlib.compress(tn))]) |
423 fp.write(tn) | 424 fp.write(tn) |
424 fp.write('\n') | 425 fp.write('\n') |
425 | 426 |