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

Augie Fackler raf at durin42.com
Mon May 22 15:09:20 EDT 2017


# HG changeset patch
# User Augie Fackler <augie at 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.

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))
 


More information about the Mercurial-devel mailing list