[PATCH 1 of 2 STABLE] formatter: handle nested dictionaries

timeless timeless at fmr.im
Thu Apr 21 02:09:06 EDT 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1461210821 0
#      Thu Apr 21 03:53:41 2016 +0000
# Branch stable
# Node ID 24fa6b119f160b3adf25c1018bb322ca4db9b948
# Parent  1967c6b714e6bc2e3ffe7ea0197a5f2b42b53320
# Available At bb://timeless/mercurial-crew
#              hg pull bb://timeless/mercurial-crew -r 24fa6b119f16
formatter: handle nested dictionaries

diff -r 1967c6b714e6 -r 24fa6b119f16 mercurial/formatter.py
--- a/mercurial/formatter.py	Fri Apr 15 14:28:26 2016 -0700
+++ b/mercurial/formatter.py	Thu Apr 21 03:53:41 2016 +0000
@@ -120,6 +120,10 @@
         return 'false'
     elif isinstance(v, (int, float)):
         return str(v)
+    elif isinstance(v, dict):
+        return ('{' + ', '.join('%s: %s' %
+            (_jsonifyobj(k), _jsonifyobj(v[k])) for k in v) +
+                '}')
     else:
         return '"%s"' % encoding.jsonescape(v)
 


More information about the Mercurial-devel mailing list