[PATCH 3 of 6] formatter: load templates section like a map file

Yuya Nishihara yuya at tcha.org
Fri Jun 16 22:51:43 EDT 2017


On Fri, 16 Jun 2017 10:59:28 -0700, Martin von Zweigbergk wrote:
> On Fri, Jun 16, 2017 at 9:37 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> > # HG changeset patch
> > # User Yuya Nishihara <yuya at tcha.org>
> > # Date 1492859695 -32400
> > #      Sat Apr 22 20:14:55 2017 +0900
> > # Node ID 32ea66830e68419c6c97c0bcfc53f053f628b399
> > # Parent  06b1ac59547e8ef086bae9bc51740318c7661e7e
> > formatter: load templates section like a map file

> > -  $ echo '[templates]' >> .hg/hgrc
> > -  $ printf 'simple = "{rev}\\n"\n' >> .hg/hgrc
> > -  $ printf 'simple2 = {rev}\\n\n' >> .hg/hgrc
> > +  $ cat <<'EOF' >> .hg/hgrc
> > +  > [templates]
> > +  > simple = "{rev}\n"
> > +  > simple2 = {rev}\n
> > +  > rev = "should not precede {rev} keyword\n"
> 
> Why would you want to do this? In other words, why don't we
> reject/warn/ignore that instead? I'm guessing it's because we already
> have supported this form, so we don't want to break BC?

templates.rev, the definition, is still valid since it can be referenced
by '-T rev'. As the built-in keywords space may grow, we can't reliably
reject template definitions conflicting with the future builtins.

Another reason is that hgweb templates rely on this weird behavior.


More information about the Mercurial-devel mailing list