diffutil: rewrite an ersatz ternary operator for building diffopts.text
Pytype tends to get confused by these, but the real problem here is that if the
caller passes `opts={}` as TortoiseHg has been doing, that is set as the value
for `diffopts.text` when in reality it expects a boolean. When `None` is passed
explicitly, the default value in `mdiff.defaultopts` is assigned.
--- a/mercurial/diffutil.py Mon Jan 09 14:34:19 2023 -0500
+++ b/mercurial/diffutil.py Tue Jan 10 12:55:49 2023 -0500
@@ -120,7 +120,7 @@
)
buildopts[b'ignorewseol'] = get(b'ignore_space_at_eol', b'ignorewseol')
if formatchanging:
- buildopts[b'text'] = opts and opts.get(b'text')
+ buildopts[b'text'] = None if opts is None else opts.get(b'text')
binary = None if opts is None else opts.get(b'binary')
buildopts[b'nobinary'] = (
not binary