Patchwork [2,of,5] cmdutil: rename template param to export to fntemplate

login
register
mail settings
Submitter Augie Fackler
Date May 22, 2017, 7:09 p.m.
Message ID <027b540c089253b9c600.1495480160@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/20841/
State Accepted
Headers show

Comments

Augie Fackler - May 22, 2017, 7:09 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1495325705 14400
#      Sat May 20 20:15:05 2017 -0400
# Node ID 027b540c089253b9c600cc36e638953b0f9c5d14
# Parent  eb70e8c53a2826d377448d7ce3da00ac41565fd2
cmdutil: rename template param to export to fntemplate

It's actually a template for the filename, not a formatter template.

Patch

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -240,7 +240,7 @@  def dodiff(ui, repo, cmdline, pats, opts
         else:
             template = 'hg-%h.patch'
             cmdutil.export(repo, [repo[node1a].rev(), repo[node2].rev()],
-                           template=repo.vfs.reljoin(tmproot, template),
+                           fntemplate=repo.vfs.reljoin(tmproot, template),
                            match=matcher)
             label1a = cmdutil.makefilename(repo, template, node1a)
             label2 = cmdutil.makefilename(repo, template, node2)
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1141,14 +1141,14 @@  extraexport = []
 # it is given two arguments (sequencenumber, changectx)
 extraexportmap = {}
 
-def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False,
+def export(repo, revs, fntemplate='hg-%h.patch', fp=None, switch_parent=False,
            opts=None, match=None):
     '''export changesets as hg patches
 
     Args:
       repo: The repository from which we're exporting revisions.
       revs: A list of revisions to export as revision numbers.
-      template: An optional string to use for generating patch file names.
+      fntemplate: An optional string to use for generating patch file names.
       fp: An optional file-like object to which patches should be written.
       switch_parent: If True, show diffs against second parent when not nullid.
                      Default is false, which always shows diff against p1.
@@ -1163,7 +1163,7 @@  def export(repo, revs, template='hg-%h.p
       destinations:
         fp is specified: All revs are written to the specified
                          file-like object.
-        template specified: Each rev is written to a unique file named using
+        fntemplate specified: Each rev is written to a unique file named using
                             the given template.
         Neither fp nor template specified: All revs written to repo.ui.write()
     '''
@@ -1186,10 +1186,10 @@  def export(repo, revs, template='hg-%h.p
             prev = nullid
 
         shouldclose = False
-        if not fp and len(template) > 0:
+        if not fp and len(fntemplate) > 0:
             desc_lines = ctx.description().rstrip().split('\n')
             desc = desc_lines[0]    #Commit always has a first line.
-            fp = makefileobj(repo, template, node, desc=desc, total=total,
+            fp = makefileobj(repo, fntemplate, node, desc=desc, total=total,
                              seqno=seqno, revwidth=revwidth, mode='wb',
                              modemap=filemode)
             shouldclose = True
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2001,7 +2001,7 @@  def export(ui, repo, *changesets, **opts
     else:
         ui.note(_('exporting patch:\n'))
     ui.pager('export')
-    cmdutil.export(repo, revs, template=opts.get('output'),
+    cmdutil.export(repo, revs, fntemplate=opts.get('output'),
                  switch_parent=opts.get('switch_parent'),
                  opts=patch.diffallopts(ui, opts))