template: allow unquoted int function arguments

This commit is contained in:
Brendan Cully 2013-04-07 23:25:50 -07:00
parent 5659e9d1ac
commit 1c111a8da8
2 changed files with 10 additions and 1 deletions

View File

@ -66,7 +66,10 @@ def tokenizer(data):
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

View File

@ -1360,6 +1360,12 @@ Age filter:
$ 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@hostname>
Error on syntax:
$ echo 'x = "f' >> t