comparison mercurial/formatter.py @ 31396:ab3e9eab754f

formatter: support json formatting of long type By luck, we appear to not pass any long instances into the JSON formatter. I suspect this will change with all the Python 3 porting work. Plus I have another series that will convert some ints to longs that triggers this.
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 13 Mar 2017 18:31:29 -0700
parents 59d09565ac77
children 654e9a1c8a6c
comparison
equal deleted inserted replaced
31395:361bccce566a 31396:ab3e9eab754f
293 return 'null' 293 return 'null'
294 elif v is True: 294 elif v is True:
295 return 'true' 295 return 'true'
296 elif v is False: 296 elif v is False:
297 return 'false' 297 return 'false'
298 elif isinstance(v, (int, float)): 298 elif isinstance(v, (int, long, float)):
299 return str(v) 299 return str(v)
300 else: 300 else:
301 return '"%s"' % encoding.jsonescape(v) 301 return '"%s"' % encoding.jsonescape(v)
302 302
303 class jsonformatter(baseformatter): 303 class jsonformatter(baseformatter):