changeset 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 9e641c4525a2
children 386c1e45e671
files mercurial/logcmdutil.py
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/logcmdutil.py	Sun Feb 04 10:33:14 2018 +0900
+++ b/mercurial/logcmdutil.py	Sun Jan 21 13:47:06 2018 +0900
@@ -122,12 +122,12 @@
 class changesetprinter(object):
     '''show changeset information when templating not requested.'''
 
-    def __init__(self, ui, repo, matchfn, diffopts, buffered):
+    def __init__(self, ui, repo, matchfn=None, diffopts=None, buffered=False):
         self.ui = ui
         self.repo = repo
         self.buffered = buffered
         self.matchfn = matchfn
-        self.diffopts = diffopts
+        self.diffopts = diffopts or {}
         self.header = {}
         self.hunk = {}
         self.lastheader = None
@@ -290,7 +290,7 @@
 class jsonchangeset(changesetprinter):
     '''format changeset information.'''
 
-    def __init__(self, ui, repo, matchfn, diffopts, buffered):
+    def __init__(self, ui, repo, matchfn=None, diffopts=None, buffered=False):
         changesetprinter.__init__(self, ui, repo, matchfn, diffopts, buffered)
         self.cache = {}
         self._first = True
@@ -399,8 +399,6 @@
     # adding/removing arguments before "buffered" to not break callers.
     def __init__(self, ui, repo, tmplspec, matchfn=None, diffopts=None,
                  buffered=False):
-        diffopts = diffopts or {}
-
         changesetprinter.__init__(self, ui, repo, matchfn, diffopts, buffered)
         tres = formatter.templateresources(ui, repo)
         self.t = formatter.loadtemplater(ui, tmplspec,