mercurial/formatter.py
changeset 51690 493034cc3265
parent 48946 642e31cb55f0
child 51700 7f0cb9ee0534
equal deleted inserted replaced
51689:39e2b2d062c1 51690:493034cc3265
   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 
       
   180     # set to True if the formater output a strict format that does not support
   179     # set to True if the formater output a strict format that does not support
   181     # arbitrary output in the stream.
   180     # arbitrary output in the stream.
   182     strict_format = False
   181     strict_format = False
   183 
   182 
   184     def __init__(self, ui, topic, opts, converter):
   183     def __init__(self, ui, topic, opts, converter):
   419         baseformatter.end(self)
   418         baseformatter.end(self)
   420         self._out.write(cborutil.BREAK)
   419         self._out.write(cborutil.BREAK)
   421 
   420 
   422 
   421 
   423 class jsonformatter(baseformatter):
   422 class jsonformatter(baseformatter):
   424 
       
   425     strict_format = True
   423     strict_format = True
   426 
   424 
   427     def __init__(self, ui, out, topic, opts):
   425     def __init__(self, ui, out, topic, opts):
   428         baseformatter.__init__(self, ui, topic, opts, _nullconverter)
   426         baseformatter.__init__(self, ui, topic, opts, _nullconverter)
   429         self._out = out
   427         self._out = out