comparison mercurial/formatter.py @ 32581:e9bf3e132ea9

formatter: add nullformatter This can be used as a placeholder variable.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 27 May 2017 17:44:26 +0900
parents 35985d407d49
children 526f9f12f707
comparison
equal deleted inserted replaced
32580:35985d407d49 32581:e9bf3e132ea9
205 def end(self): 205 def end(self):
206 '''end output for the formatter''' 206 '''end output for the formatter'''
207 if self._item is not None: 207 if self._item is not None:
208 self._showitem() 208 self._showitem()
209 209
210 def nullformatter(ui, topic):
211 '''formatter that prints nothing'''
212 return baseformatter(ui, topic, opts={}, converter=_nullconverter)
213
210 class _nestedformatter(baseformatter): 214 class _nestedformatter(baseformatter):
211 '''build sub items and store them in the parent formatter''' 215 '''build sub items and store them in the parent formatter'''
212 def __init__(self, ui, converter, data): 216 def __init__(self, ui, converter, data):
213 baseformatter.__init__(self, ui, topic='', opts={}, converter=converter) 217 baseformatter.__init__(self, ui, topic='', opts={}, converter=converter)
214 self._data = data 218 self._data = data