diff mercurial/patch.py @ 35990:8b6dd3922f70

patch: unify check_binary and binary flags Follows up 079b27b5a869. If opts.text=True, check_binary is ignored, so we can just pass the binary flag to unidiff(). perfunidiff now takes any inputs as text files, which I think is a desired behavior.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 04 Feb 2018 10:28:03 +0900
parents c8e2d6ed1f9e
children 95791b275b73
line wrap: on
line diff
--- a/mercurial/patch.py	Wed Feb 07 13:49:02 2018 +0530
+++ b/mercurial/patch.py	Sun Feb 04 10:28:03 2018 +0900
@@ -2699,12 +2699,9 @@
                 flag2 = ctx2.flags(f2)
         # if binary is True, output "summary" or "base85", but not "text diff"
         if opts.text:
-            check_binary = True
             binary = False
         else:
-            check_binary = any(f.isbinary()
-                               for f in [fctx1, fctx2] if f is not None)
-            binary = check_binary
+            binary = any(f.isbinary() for f in [fctx1, fctx2] if f is not None)
 
         if losedatafn and not opts.git:
             if (binary or
@@ -2794,8 +2791,8 @@
 
             uheaders, hunks = mdiff.unidiff(content1, date1,
                                             content2, date2,
-                                            path1, path2, opts=opts,
-                                            check_binary=check_binary)
+                                            path1, path2,
+                                            binary=binary, opts=opts)
             header.extend(uheaders)
         yield fctx1, fctx2, header, hunks