# HG changeset patch # User Gregory Szorc # Date 1420062535 28800 # Node ID a9f826c3eaf9dc9743571fd40d3f32b761b0132f # Parent ae5447de4c1100661fdff69397f70358394da512 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. diff -r ae5447de4c11 -r a9f826c3eaf9 mercurial/templatefilters.py --- 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) + '}'