[PATCH 1 of 2 STABLE] templater: do not process \-escapes at parsestring() (issue4290)

Sean Farley sean at farley.io
Thu May 7 19:49:49 CDT 2015


Yuya Nishihara <yuya at tcha.org> writes:

> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1430700841 -32400
> #      Mon May 04 09:54:01 2015 +0900
> # Branch stable
> # Node ID 888d7a553f2b0ace8563ea9e3ef3ab1b8a50923e
> # Parent  a4ee6f774f14b68e8dc887745699ba6a2ae28355
> templater: do not process \-escapes at parsestring() (issue4290)
>
> This patch brings back pre-2.8.1 behavior.
>
> The result of parsestring() is stored in templater's cache, t.cache, and then
> it is parsed as a template string by compiletemplate(). So t.cache should keep
> an unparsed string no matter if it is sourced from config value. Otherwise
> backslashes would be processed twice.
>
> The test vector is borrowed from 64b4f0cd7336.

So, this breaks the following template for me:

$ cat ~/sandbox/.hgrc
[templates]
sl = "{tags % \"{ifeq(tag,'tip','',label('log.tag', ' {tag}'))}\"}"

$ HGRCPATH=~/sandbox/.hgrc lhg log -G -T sl -r 3.4-rc
obsolete feature not enabled but 68581 markers found!
hg: parse error at 8: syntax error

Matt's original 64b4f0cd7336 changeset was written side-by-side with me
at a coffee shop in NYC. It seems there is still a corner case with
issue4102 that I'm hitting.


More information about the Mercurial-devel mailing list