Patchwork [3,of,3] filemerge: optionally strip quotes from merge marker template (BC)

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

Comments

Yuya Nishihara - April 15, 2017, 10:51 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1488018962 -32400
#      Sat Feb 25 19:36:02 2017 +0900
# Node ID aea294cf17416c162143292b8f6594fa33bab78b
# Parent  51323898479b04d2063a880c9aecce116d83a6b9
filemerge: optionally strip quotes from merge marker template (BC)

For consistency with the other template options. Quotes are necessary if
you want to preserve leading/trailing whitespace, which would be stripped
by config parser.
Augie Fackler - April 18, 2017, 3:39 p.m.
On Sat, Apr 15, 2017 at 07:51:33PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1488018962 -32400
> #      Sat Feb 25 19:36:02 2017 +0900
> # Node ID aea294cf17416c162143292b8f6594fa33bab78b
> # Parent  51323898479b04d2063a880c9aecce116d83a6b9
> filemerge: optionally strip quotes from merge marker template (BC)

queued, thanks

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -543,6 +543,7 @@  def _formatlabels(repo, fcd, fco, fca, l
 
     ui = repo.ui
     template = ui.config('ui', 'mergemarkertemplate', _defaultconflictmarker)
+    template = templater.unquotestring(template)
     tmpl = formatter.maketemplater(ui, 'conflictmarker', template)
 
     pad = max(len(l) for l in labels)
diff --git a/tests/test-conflict.t b/tests/test-conflict.t
--- a/tests/test-conflict.t
+++ b/tests/test-conflict.t
@@ -65,7 +65,10 @@ 
 Verify custom conflict markers
 
   $ hg up -q --clean .
-  $ printf "\n[ui]\nmergemarkertemplate={author} {rev}\n" >> .hg/hgrc
+  $ cat <<EOF >> .hg/hgrc
+  > [ui]
+  > mergemarkertemplate = '{author} {rev}'
+  > EOF
 
   $ hg merge 1
   merging a