##// END OF EJS Templates
logcmdutil: pass formatter to jsonchangeset as argument...
Yuya Nishihara -
r37791:0f084741 default
parent child Browse files
Show More
@@ -310,12 +310,13 b' class changesetprinter(object):'
310 if stat or diff:
310 if stat or diff:
311 self.ui.write("\n")
311 self.ui.write("\n")
312
312
313 class jsonchangeset(changesetprinter):
313 class changesetformatter(changesetprinter):
314 '''format changeset information.'''
314 """Format changeset information by generic formatter"""
315
315
316 def __init__(self, ui, repo, differ=None, diffopts=None, buffered=False):
316 def __init__(self, ui, repo, fm, differ=None, diffopts=None,
317 buffered=False):
317 changesetprinter.__init__(self, ui, repo, differ, diffopts, buffered)
318 changesetprinter.__init__(self, ui, repo, differ, diffopts, buffered)
318 self._fm = formatter.jsonformatter(ui, ui, 'log', {})
319 self._fm = fm
319
320
320 def close(self):
321 def close(self):
321 self._fm.end()
322 self._fm.end()
@@ -519,7 +520,8 b' def changesetdisplayer(ui, repo, opts, d'
519 """
520 """
520 postargs = (differ, opts, buffered)
521 postargs = (differ, opts, buffered)
521 if opts.get('template') == 'json':
522 if opts.get('template') == 'json':
522 return jsonchangeset(ui, repo, *postargs)
523 fm = ui.formatter('log', opts)
524 return changesetformatter(ui, repo, fm, *postargs)
523
525
524 spec = _lookuptemplate(ui, opts.get('template'), opts.get('style'))
526 spec = _lookuptemplate(ui, opts.get('template'), opts.get('style'))
525
527
General Comments 0
You need to be logged in to leave comments. Login now