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

Yuya Nishihara yuya at tcha.org
Sat Apr 15 06:51:32 EDT 2017


# HG changeset patch
# User Yuya Nishihara <yuya at 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.

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}


More information about the Mercurial-devel mailing list