mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
templatefilters: fix crash by string formatting of '{x|splitlines}'
Before, it crashed because mapping['templ'] was missing. As it didn't support the legacy list template from the beginning, we can simply use hybridlist().
This commit is contained in:
parent
3a01d624e0
commit
e952ac99ea
@ -339,7 +339,7 @@ def shortdate(text):
|
||||
@templatefilter('splitlines')
|
||||
def splitlines(text):
|
||||
"""Any text. Split text into a list of lines."""
|
||||
return templatekw.showlist('line', text.splitlines(), {}, plural='lines')
|
||||
return templatekw.hybridlist(text.splitlines(), name='line')
|
||||
|
||||
@templatefilter('stringescape')
|
||||
def stringescape(text):
|
||||
|
@ -3894,6 +3894,11 @@ Test splitlines
|
||||
o foo line 1
|
||||
foo line 2
|
||||
|
||||
$ hg log -R a -r0 -T '{desc|splitlines}\n'
|
||||
line 1 line 2
|
||||
$ hg log -R a -r0 -T '{join(desc|splitlines, "|")}\n'
|
||||
line 1|line 2
|
||||
|
||||
Test startswith
|
||||
$ hg log -Gv -R a --template "{startswith(desc)}"
|
||||
hg: parse error: startswith expects two arguments
|
||||
|
Loading…
Reference in New Issue
Block a user