Mercurial > public > mercurial-scm > hg
comparison mercurial/formatter.py @ 24321:0a714a1f7d5c
formatter: convert None to json null
It will be used by "annotate" command to represent the workingctx revision.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 17 Sep 2014 22:34:34 +0900 |
parents | cb28d2b3db0b |
children | c2a4dfe2a336 |
comparison
equal
deleted
inserted
replaced
24320:b9f7f3eeb99c | 24321:0a714a1f7d5c |
---|---|
96 self._ui.write(cPickle.dumps(self._data)) | 96 self._ui.write(cPickle.dumps(self._data)) |
97 | 97 |
98 def _jsonifyobj(v): | 98 def _jsonifyobj(v): |
99 if isinstance(v, tuple): | 99 if isinstance(v, tuple): |
100 return '[' + ', '.join(_jsonifyobj(e) for e in v) + ']' | 100 return '[' + ', '.join(_jsonifyobj(e) for e in v) + ']' |
101 elif v is None: | |
102 return 'null' | |
101 elif v is True: | 103 elif v is True: |
102 return 'true' | 104 return 'true' |
103 elif v is False: | 105 elif v is False: |
104 return 'false' | 106 return 'false' |
105 elif isinstance(v, (int, float)): | 107 elif isinstance(v, (int, float)): |