2697 fctx2 = getfilectx(f2, ctx2) |
2697 fctx2 = getfilectx(f2, ctx2) |
2698 if opts.git or losedatafn: |
2698 if opts.git or losedatafn: |
2699 flag2 = ctx2.flags(f2) |
2699 flag2 = ctx2.flags(f2) |
2700 # if binary is True, output "summary" or "base85", but not "text diff" |
2700 # if binary is True, output "summary" or "base85", but not "text diff" |
2701 if opts.text: |
2701 if opts.text: |
2702 check_binary = True |
|
2703 binary = False |
2702 binary = False |
2704 else: |
2703 else: |
2705 check_binary = any(f.isbinary() |
2704 binary = any(f.isbinary() for f in [fctx1, fctx2] if f is not None) |
2706 for f in [fctx1, fctx2] if f is not None) |
|
2707 binary = check_binary |
|
2708 |
2705 |
2709 if losedatafn and not opts.git: |
2706 if losedatafn and not opts.git: |
2710 if (binary or |
2707 if (binary or |
2711 # copy/rename |
2708 # copy/rename |
2712 f2 in copy or |
2709 f2 in copy or |
2792 gitindex(content2)[0:opts.index], |
2789 gitindex(content2)[0:opts.index], |
2793 gitmode[flag])) |
2790 gitmode[flag])) |
2794 |
2791 |
2795 uheaders, hunks = mdiff.unidiff(content1, date1, |
2792 uheaders, hunks = mdiff.unidiff(content1, date1, |
2796 content2, date2, |
2793 content2, date2, |
2797 path1, path2, opts=opts, |
2794 path1, path2, |
2798 check_binary=check_binary) |
2795 binary=binary, opts=opts) |
2799 header.extend(uheaders) |
2796 header.extend(uheaders) |
2800 yield fctx1, fctx2, header, hunks |
2797 yield fctx1, fctx2, header, hunks |
2801 |
2798 |
2802 def diffstatsum(stats): |
2799 def diffstatsum(stats): |
2803 maxfile, maxtotal, addtotal, removetotal, binary = 0, 0, 0, 0, False |
2800 maxfile, maxtotal, addtotal, removetotal, binary = 0, 0, 0, 0, False |