Mercurial > hg
comparison mercurial/logcmdutil.py @ 35953:64f4a6808704
logcmdutil: make default parameters of changesetprinters consistent
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 21 Jan 2018 13:47:06 +0900 |
parents | 572f36e9a780 |
children | 218b77c4c87a |
comparison
equal
deleted
inserted
replaced
35952:9e641c4525a2 | 35953:64f4a6808704 |
---|---|
120 return ' '.join(labels) | 120 return ' '.join(labels) |
121 | 121 |
122 class changesetprinter(object): | 122 class changesetprinter(object): |
123 '''show changeset information when templating not requested.''' | 123 '''show changeset information when templating not requested.''' |
124 | 124 |
125 def __init__(self, ui, repo, matchfn, diffopts, buffered): | 125 def __init__(self, ui, repo, matchfn=None, diffopts=None, buffered=False): |
126 self.ui = ui | 126 self.ui = ui |
127 self.repo = repo | 127 self.repo = repo |
128 self.buffered = buffered | 128 self.buffered = buffered |
129 self.matchfn = matchfn | 129 self.matchfn = matchfn |
130 self.diffopts = diffopts | 130 self.diffopts = diffopts or {} |
131 self.header = {} | 131 self.header = {} |
132 self.hunk = {} | 132 self.hunk = {} |
133 self.lastheader = None | 133 self.lastheader = None |
134 self.footer = None | 134 self.footer = None |
135 self._columns = templatekw.getlogcolumns() | 135 self._columns = templatekw.getlogcolumns() |
288 self.ui.write("\n") | 288 self.ui.write("\n") |
289 | 289 |
290 class jsonchangeset(changesetprinter): | 290 class jsonchangeset(changesetprinter): |
291 '''format changeset information.''' | 291 '''format changeset information.''' |
292 | 292 |
293 def __init__(self, ui, repo, matchfn, diffopts, buffered): | 293 def __init__(self, ui, repo, matchfn=None, diffopts=None, buffered=False): |
294 changesetprinter.__init__(self, ui, repo, matchfn, diffopts, buffered) | 294 changesetprinter.__init__(self, ui, repo, matchfn, diffopts, buffered) |
295 self.cache = {} | 295 self.cache = {} |
296 self._first = True | 296 self._first = True |
297 | 297 |
298 def close(self): | 298 def close(self): |
397 | 397 |
398 # Arguments before "buffered" used to be positional. Consider not | 398 # Arguments before "buffered" used to be positional. Consider not |
399 # adding/removing arguments before "buffered" to not break callers. | 399 # adding/removing arguments before "buffered" to not break callers. |
400 def __init__(self, ui, repo, tmplspec, matchfn=None, diffopts=None, | 400 def __init__(self, ui, repo, tmplspec, matchfn=None, diffopts=None, |
401 buffered=False): | 401 buffered=False): |
402 diffopts = diffopts or {} | |
403 | |
404 changesetprinter.__init__(self, ui, repo, matchfn, diffopts, buffered) | 402 changesetprinter.__init__(self, ui, repo, matchfn, diffopts, buffered) |
405 tres = formatter.templateresources(ui, repo) | 403 tres = formatter.templateresources(ui, repo) |
406 self.t = formatter.loadtemplater(ui, tmplspec, | 404 self.t = formatter.loadtemplater(ui, tmplspec, |
407 defaults=templatekw.keywords, | 405 defaults=templatekw.keywords, |
408 resources=tres, | 406 resources=tres, |