mercurial/formatter.py
changeset 51700 7f0cb9ee0534
parent 51690 493034cc3265
child 51703 ca7bde5dbafb
equal deleted inserted replaced
51699:bd1483fd7088 51700:7f0cb9ee0534
   174         '''convert iterable to appropriate list format'''
   174         '''convert iterable to appropriate list format'''
   175         return list(data)
   175         return list(data)
   176 
   176 
   177 
   177 
   178 class baseformatter:
   178 class baseformatter:
       
   179 
   179     # set to True if the formater output a strict format that does not support
   180     # set to True if the formater output a strict format that does not support
   180     # arbitrary output in the stream.
   181     # arbitrary output in the stream.
   181     strict_format = False
   182     strict_format = False
   182 
   183 
   183     def __init__(self, ui, topic, opts, converter):
   184     def __init__(self, ui, topic, opts, converter):
   418         baseformatter.end(self)
   419         baseformatter.end(self)
   419         self._out.write(cborutil.BREAK)
   420         self._out.write(cborutil.BREAK)
   420 
   421 
   421 
   422 
   422 class jsonformatter(baseformatter):
   423 class jsonformatter(baseformatter):
       
   424 
   423     strict_format = True
   425     strict_format = True
   424 
   426 
   425     def __init__(self, ui, out, topic, opts):
   427     def __init__(self, ui, out, topic, opts):
   426         baseformatter.__init__(self, ui, topic, opts, _nullconverter)
   428         baseformatter.__init__(self, ui, topic, opts, _nullconverter)
   427         self._out = out
   429         self._out = out