# HG changeset patch # User Matt Harbison # Date 1673373349 18000 # Node ID 024e0580b8531421db48746aa67e972eb3ba861a # Parent a78dfb1ad60eeeb247f48ad11af7fdfcad3916b9 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. diff -r a78dfb1ad60e -r 024e0580b853 mercurial/diffutil.py --- 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