From patchwork Thu Oct 2 14:59:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5,of,6] formatter: convert booleans to json From: Yuya Nishihara X-Patchwork-Id: 6087 Message-Id: <356766f9b906dea2d322.1412261947@mimosa> To: mercurial-devel@selenic.com Date: Thu, 02 Oct 2014 23:59:07 +0900 # HG changeset patch # User Yuya Nishihara # 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: