[PATCH 5 of 6] formatter: convert booleans to json

Yuya Nishihara yuya at tcha.org
Thu Oct 2 09:59:07 CDT 2014


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1412259659 -32400
#      Thu Oct 02 23:20:59 2014 +0900
# Node ID 356766f9b906dea2d3224309695edfec76f14426
# Parent  2b3a3dad49f22eade2dd8576aa8374f175f71de5
formatter: convert booleans to json

It will be used in branches output.

diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -91,6 +91,10 @@ class pickleformatter(baseformatter):
 def _jsonifyobj(v):
     if isinstance(v, tuple):
         return '[' + ', '.join(_jsonifyobj(e) for e in v) + ']'
+    elif v is True:
+        return 'true'
+    elif v is False:
+        return 'false'
     elif isinstance(v, (int, float)):
         return str(v)
     else:


More information about the Mercurial-devel mailing list