comparison mercurial/patch.py @ 4092:4ced663bebf0

git patches: handle renames of binary files
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 16 Feb 2007 04:54:46 -0200
parents 2b3175acb653
children 49237d6ae97d ed46895aa38c
comparison
equal deleted inserted replaced
4091:3d7480ada3e5 4092:4ced663bebf0
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:
416 return
415 # TODO: deltas 417 # TODO: deltas
416 l = len(tn) 418 l = len(tn)
417 fp.write('index %s..%s\nGIT binary patch\nliteral %s\n' % 419 fp.write('index %s..%s\nGIT binary patch\nliteral %s\n' %
418 (gitindex(to), gitindex(tn), len(tn))) 420 (gitindex(to), gitindex(tn), len(tn)))
419 421
591 header.append('%s from %s\n' % (op, a)) 593 header.append('%s from %s\n' % (op, a))
592 header.append('%s to %s\n' % (op, f)) 594 header.append('%s to %s\n' % (op, f))
593 to = getfile(a).read(arev) 595 to = getfile(a).read(arev)
594 else: 596 else:
595 header.append('new file mode %s\n' % mode) 597 header.append('new file mode %s\n' % mode)
596 if util.binary(tn): 598 if util.binary(tn):
597 dodiff = 'binary' 599 dodiff = 'binary'
598 elif f in removed: 600 elif f in removed:
599 if f in srcs: 601 if f in srcs:
600 dodiff = False 602 dodiff = False
601 else: 603 else:
602 mode = gitmode(mmap.execf(f)) 604 mode = gitmode(mmap.execf(f))