Show More
@@ -415,14 +415,15 b' def b85diff(fp, to, tn):' | |||||
415 | tohash = gitindex(to) |
|
415 | tohash = gitindex(to) | |
416 | tnhash = gitindex(tn) |
|
416 | tnhash = gitindex(tn) | |
417 | if tohash == tnhash: |
|
417 | if tohash == tnhash: | |
418 | return |
|
418 | return "" | |
|
419 | ||||
419 | # TODO: deltas |
|
420 | # TODO: deltas | |
420 |
|
|
421 | ret = ['index %s..%s\nGIT binary patch\nliteral %s\n' % | |
421 |
|
|
422 | (tohash, tnhash, len(tn))] | |
422 |
|
423 | for l in chunk(zlib.compress(tn)): | ||
423 | tn = ''.join([fmtline(l) for l in chunk(zlib.compress(tn))]) |
|
424 | ret.append(fmtline(l)) | |
424 | fp.write(tn) |
|
425 | ret.append('\n') | |
425 | fp.write('\n') |
|
426 | return ''.join(ret) | |
426 |
|
427 | |||
427 | def diff(repo, node1=None, node2=None, files=None, match=util.always, |
|
428 | def diff(repo, node1=None, node2=None, files=None, match=util.always, | |
428 | fp=None, changes=None, opts=None): |
|
429 | fp=None, changes=None, opts=None): | |
@@ -615,11 +616,11 b' def diff(repo, node1=None, node2=None, f' | |||||
615 | dodiff = 'binary' |
|
616 | dodiff = 'binary' | |
616 | r = None |
|
617 | r = None | |
617 | header.insert(0, 'diff --git a/%s b/%s\n' % (a, b)) |
|
618 | header.insert(0, 'diff --git a/%s b/%s\n' % (a, b)) | |
618 |
if dodiff |
|
619 | if dodiff: | |
619 | fp.write(''.join(header)) |
|
620 | if dodiff == 'binary': | |
620 | b85diff(fp, to, tn) |
|
621 | text = b85diff(fp, to, tn) | |
621 | elif dodiff: |
|
622 | else: | |
622 | text = mdiff.unidiff(to, date1, tn, date2(f), f, r, opts=opts) |
|
623 | text = mdiff.unidiff(to, date1, tn, date2(f), f, r, opts=opts) | |
623 | if text or len(header) > 1: |
|
624 | if text or len(header) > 1: | |
624 | fp.write(''.join(header)) |
|
625 | fp.write(''.join(header)) | |
625 | fp.write(text) |
|
626 | fp.write(text) |
General Comments 0
You need to be logged in to leave comments.
Login now