# HG changeset patch # User Yuya Nishihara <y...@tcha.org> # Date 1538289985 -32400 # Sun Sep 30 15:46:25 2018 +0900 # Node ID 6b1a87ee8753534543236e3a64e66e8f0382b5eb # Parent 22f0acc9d2d80ae870d92636d9023b7849b616bb templatefilters: alias element of {_|splitlines} to {text}
We've renamed {line} of annotation result as such. diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -387,7 +387,9 @@ def slashpath(path): @templatefilter('splitlines', intype=bytes) def splitlines(text): """Any text. Split text into a list of lines.""" - return templateutil.hybridlist(text.splitlines(), name='line') + return templateutil.hybrid(None, text.splitlines(), + lambda x: {'line': x, 'text': x}, + pycompat.identity) @templatefilter('stringescape', intype=bytes) def stringescape(text): diff --git a/tests/test-template-functions.t b/tests/test-template-functions.t --- a/tests/test-template-functions.t +++ b/tests/test-template-functions.t @@ -1254,6 +1254,10 @@ Test splitlines o foo line 1 foo line 2 + $ hg log -R a -r0 -T '{desc|splitlines % "{text}\n"}' + line 1 + 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' _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel