[PATCH 2 of 4 V2] cmdutil: reorder optional arguments passed to makefileobj()

Yuya Nishihara yuya at tcha.org
Sun Feb 18 00:18:00 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1518919095 -32400
#      Sun Feb 18 10:58:15 2018 +0900
# Node ID 35140c6c0e66f16061bf2757852655b476bacafa
# Parent  44e712e75c4046df45ad5c8f6731aaa0633a6a1b
cmdutil: reorder optional arguments passed to makefileobj()

**props will be passed directly to templater.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -954,10 +954,7 @@ class _unclosablefile(object):
     def __exit__(self, exc_type, exc_value, exc_tb):
         pass
 
-def makefileobj(ctx, pat, total=None,
-                seqno=None, revwidth=None, mode='wb', modemap=None,
-                pathname=None):
-
+def makefileobj(ctx, pat, mode='wb', modemap=None, **props):
     writable = mode not in ('r', 'rb')
 
     if isstdiofilename(pat):
@@ -967,7 +964,7 @@ def makefileobj(ctx, pat, total=None,
         else:
             fp = repo.ui.fin
         return _unclosablefile(fp)
-    fn = makefilename(ctx, pat, total, seqno, revwidth, pathname)
+    fn = makefilename(ctx, pat, **props)
     if modemap is not None:
         mode = modemap.get(fn, mode)
         if mode == 'wb':
@@ -1542,9 +1539,8 @@ def export(repo, revs, fntemplate='hg-%h
         ctx = repo[rev]
         fo = None
         if not fp and fntemplate:
-            fo = makefileobj(ctx, fntemplate,
-                             total=total, seqno=seqno, revwidth=revwidth,
-                             mode='wb', modemap=filemode)
+            fo = makefileobj(ctx, fntemplate, mode='wb', modemap=filemode,
+                             total=total, seqno=seqno, revwidth=revwidth)
             dest = fo.name
             def write(s, **kw):
                 fo.write(s)


More information about the Mercurial-devel mailing list