Patchwork [2,of,3] commit: optionally strip quotes from commit template (BC)

login
register
mail settings
Submitter Yuya Nishihara
Date April 15, 2017, 10:51 a.m.
Message ID <51323898479b04d2063a.1492253492@mimosa>
Download mbox | patch
Permalink /patch/20219/
State Accepted
Headers show

Comments

Yuya Nishihara - April 15, 2017, 10:51 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1488018759 -32400
#      Sat Feb 25 19:32:39 2017 +0900
# Node ID 51323898479b04d2063a880c9aecce116d83a6b9
# Parent  911c62c727e9c0d628158a1655c1b69f725d20df
commit: optionally strip quotes from commit template (BC)

For consistency with the other template options.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2759,6 +2759,7 @@  def commitforceeditor(repo, ctx, subs, f
     while forms:
         tmpl = repo.ui.config('committemplate', '.'.join(forms))
         if tmpl:
+            tmpl = templater.unquotestring(tmpl)
             templatetext = committext = buildcommittemplate(
                 repo, ctx, subs, extramsg, tmpl)
             break
diff --git a/tests/test-commit.t b/tests/test-commit.t
--- a/tests/test-commit.t
+++ b/tests/test-commit.t
@@ -387,12 +387,12 @@  specific template keywords work well
 
   $ cat >> .hg/hgrc <<EOF
   > [committemplate]
-  > changeset.commit.normal = HG: this is "commit.normal" template
+  > changeset.commit.normal = 'HG: this is "commit.normal" template
   >     HG: {extramsg}
   >     {if(activebookmark,
   >    "HG: bookmark '{activebookmark}' is activated\n",
   >    "HG: no bookmark is activated\n")}{subrepos %
-  >    "HG: subrepo '{subrepo}' is changed\n"}
+  >    "HG: subrepo '{subrepo}' is changed\n"}'
   > 
   > changeset.commit = HG: this is "commit" template
   >     HG: {extramsg}