[PATCH] template: allow unquoted int function arguments

Brendan Cully brendan at kublai.com
Tue Apr 9 12:25:40 CDT 2013


On Wednesday, 10 April 2013 at 01:49, FUJIWARA Katsunori wrote:
> 
> At Sun, 07 Apr 2013 23:26:21 -0700,
> Brendan Cully wrote:
> > 
> > # HG changeset patch
> > # User Brendan Cully <brendan at kublai.com>
> > # Date 1365402350 25200
> > #      Sun Apr 07 23:25:50 2013 -0700
> > # Node ID 5e8ca3d6df6c2c92ad6e30ebb05ace3c36f59be7
> > # Parent  565482e2ac6b71125e74adf409939bf54bad274f
> > template: allow unquoted int function arguments
> > 
> > diff --git a/mercurial/templater.py b/mercurial/templater.py
> > --- a/mercurial/templater.py
> > +++ b/mercurial/templater.py
> > @@ -66,7 +66,10 @@
> >                      break
> >                  pos += 1
> >              sym = program[s:pos]
> > -            yield ('symbol', sym, s)
> > +            try:
> > +                yield('string', str(int(sym)), s)
> > +            except ValueError:
> > +                yield ('symbol', sym, s)
> >              pos -= 1
> >          elif c == '}':
> >              pos += 1
> > diff --git a/tests/test-command-template.t b/tests/test-command-template.t
> > --- a/tests/test-command-template.t
> > +++ b/tests/test-command-template.t
> > @@ -1360,6 +1360,12 @@
> >    $ hg log -l1 --template '{date|age}\n'
> >    7 years from now
> >  
> > +Filter with int function argument:
> > +
> > +  $ hg log --template '{fill(author, 20)}\n' -r 0
> > +  User Name
> > +  <user at hostname>
> > +
> >  Error on syntax:
> >  
> >    $ echo 'x = "f' >> t
> 
> This change seems to cause below test failure: "templater.engine" is
> used in schemes extension.
> 
> ========================================
> make -k test-schemes.t
> cd tests && python run-tests.py  test-schemes.t
> python hash seed: 1524144202
> 
> --- /home/fujiwara/anyware/mercurial/repo/selenic.com/hg/tests/test-schemes.t
> +++ /home/fujiwara/anyware/mercurial/repo/selenic.com/hg/tests/test-schemes.t.err
> @@ -25,15 +25,10 @@
>  check that {1} syntax works

Argh. I guess the patch will have to be backed out.


More information about the Mercurial-devel mailing list