diff -r 66a9faadbc83 -r fde4822b0102 mercurial/patch.py --- 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))