Submitter | Yuya Nishihara |
---|---|
Date | July 12, 2015, 2:55 p.m. |
Message ID | <1d80ec69ca97be815499.1436712902@mimosa> |
Download | mbox | patch |
Permalink | /patch/9959/ |
State | Accepted |
Headers | show |
Comments
On Sun, 2015-07-12 at 23:55 +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1436691565 -32400 > # Sun Jul 12 17:59:25 2015 +0900 > # Node ID 1d80ec69ca97be815499d00e21c8b6ee20a7485c > # Parent e12c8b4dbe016ba1c34fd30caabaa1c72c5b0194 > help: rewrite template examples to not use shell escaping Nice work. These are queued for default, thanks.
On 07/13/2015 11:17 PM, Matt Mackall wrote: > On Sun, 2015-07-12 at 23:55 +0900, Yuya Nishihara wrote: >> # HG changeset patch >> # User Yuya Nishihara <yuya@tcha.org> >> # Date 1436691565 -32400 >> # Sun Jul 12 17:59:25 2015 +0900 >> # Node ID 1d80ec69ca97be815499d00e21c8b6ee20a7485c >> # Parent e12c8b4dbe016ba1c34fd30caabaa1c72c5b0194 >> help: rewrite template examples to not use shell escaping > > Nice work. These are queued for default, thanks. Mads just spotted that the last change seems to introduce a single quoted string into another (existing) single quoted string. That seems wrong.
On Tue, 14 Jul 2015 16:52:41 +0200, Pierre-Yves David wrote: > On 07/13/2015 11:17 PM, Matt Mackall wrote: > > On Sun, 2015-07-12 at 23:55 +0900, Yuya Nishihara wrote: > >> # HG changeset patch > >> # User Yuya Nishihara <yuya@tcha.org> > >> # Date 1436691565 -32400 > >> # Sun Jul 12 17:59:25 2015 +0900 > >> # Node ID 1d80ec69ca97be815499d00e21c8b6ee20a7485c > >> # Parent e12c8b4dbe016ba1c34fd30caabaa1c72c5b0194 > >> help: rewrite template examples to not use shell escaping > > > > Nice work. These are queued for default, thanks. > > Mads just spotted that the last change seems to introduce a single > quoted string into another (existing) single quoted string. > > That seems wrong. It is intentional. Because escape sequences are not re-interpreted, inner template should be parsed like a shell command expansion, not like an eval: '{"{"\\"}"}\n' -> \ # shell-like, {} == $() '{"{\"\\\\\"}"}\n' -> \ # eval-like
Patch
diff --git a/mercurial/help/templates.txt b/mercurial/help/templates.txt --- a/mercurial/help/templates.txt +++ b/mercurial/help/templates.txt @@ -96,7 +96,7 @@ Some sample command line templates: - Mark the active bookmark with '*':: - $ hg log --template "{bookmarks % '{bookmark}{ifeq(bookmark, active, \"*\")} '}\n" + $ hg log --template "{bookmarks % '{bookmark}{ifeq(bookmark, active, '*')} '}\n" - Mark the working copy parent with '@':: @@ -104,7 +104,7 @@ Some sample command line templates: - Show only commit descriptions that start with "template":: - $ hg log --template "{startswith(\"template\", firstline(desc))}\n" + $ hg log --template "{startswith('template', firstline(desc))}\n" - Print the first word of each line of a commit message::