Mercurial > hg-stable
changeset 23708:a9f826c3eaf9
templatefilters.json: stabilize output
The json filter was previously iterating over keys in an object in an
undefined order. Let's throw a sorted() in there so output is
consistent.
It's somewhat frightening that there are no tests for the json filter.
Subsequent commits will add them, so we pass on the opportunity to add
them here.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 31 Dec 2014 13:48:55 -0800 |
parents | ae5447de4c11 |
children | 33e5431684c0 |
files | mercurial/templatefilters.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templatefilters.py Wed Dec 31 11:22:17 2014 -0800 +++ b/mercurial/templatefilters.py Wed Dec 31 13:48:55 2014 -0800 @@ -199,7 +199,7 @@ return '"%s"' % jsonescape(obj) elif util.safehasattr(obj, 'keys'): out = [] - for k, v in obj.iteritems(): + for k, v in sorted(obj.iteritems()): s = '%s: %s' % (json(k), json(v)) out.append(s) return '{' + ', '.join(out) + '}'