# HG changeset patch # User Yuya Nishihara # Date 1497011595 -32400 # Node ID f924dd04397460a95ecfbea8a2f2b1a3af97e088 # Parent 08d0892c93d811868771369e42fdaffad5d2e4a2 json: pass formatting options recursively This bug was introduced in 654e9a1c8a6c. It's okay to escape <>, but is unnecessary for command output. diff -r 08d0892c93d8 -r f924dd043974 mercurial/templatefilters.py --- a/mercurial/templatefilters.py Sun Apr 23 13:40:18 2017 +0900 +++ b/mercurial/templatefilters.py Fri Jun 09 21:33:15 2017 +0900 @@ -234,11 +234,12 @@ elif isinstance(obj, bytes): return '"%s"' % encoding.jsonescape(obj, paranoid=paranoid) elif util.safehasattr(obj, 'keys'): - out = ['"%s": %s' % (encoding.jsonescape(k, paranoid=paranoid), json(v)) + out = ['"%s": %s' % (encoding.jsonescape(k, paranoid=paranoid), + json(v, paranoid)) for k, v in sorted(obj.iteritems())] return '{' + ', '.join(out) + '}' elif util.safehasattr(obj, '__iter__'): - out = [json(i) for i in obj] + out = [json(i, paranoid) for i in obj] return '[' + ', '.join(out) + ']' else: raise TypeError('cannot encode type %s' % obj.__class__.__name__) diff -r 08d0892c93d8 -r f924dd043974 tests/test-obsolete.t --- a/tests/test-obsolete.t Sun Apr 23 13:40:18 2017 +0900 +++ b/tests/test-obsolete.t Fri Jun 09 21:33:15 2017 +0900 @@ -739,7 +739,7 @@ { "date": *, (glob) "flag": 0, - "metadata": {"user": "test \u003ctest@example.net\u003e"}, + "metadata": {"user": "test "}, "precnode": "cda648ca50f50482b7055c0b0c4c117bba6733d9", "succnodes": ["3de5eca88c00aa039da7399a220f4a5221faa585"] }