mercurial/patch.py
changeset 31822 fde4822b0102
parent 31821 66a9faadbc83
child 32068 51fdedd29b0a
--- a/mercurial/patch.py	Wed Apr 05 15:15:06 2017 -0700
+++ b/mercurial/patch.py	Wed Apr 05 15:31:08 2017 -0700
@@ -2210,7 +2210,9 @@
                                             'ignoreblanklines')
     if formatchanging:
         buildopts['text'] = opts and opts.get('text')
-        buildopts['nobinary'] = get('nobinary', forceplain=False)
+        binary = None if opts is None else opts.get('binary')
+        buildopts['nobinary'] = (not binary if binary is not None
+                                 else get('nobinary', forceplain=False))
         buildopts['noprefix'] = get('noprefix', forceplain=False)
 
     return mdiff.diffopts(**pycompat.strkwargs(buildopts))