Show More
@@ -162,8 +162,13 b' def buildfilter(exp, context):' | |||
|
162 | 162 | |
|
163 | 163 | def runfilter(context, mapping, data): |
|
164 | 164 | func, data, filt = data |
|
165 | # func() may return string, generator of strings or arbitrary object such | |
|
166 | # as date tuple, but filter does not want generator. | |
|
167 | thing = func(context, mapping, data) | |
|
168 | if isinstance(thing, types.GeneratorType): | |
|
169 | thing = stringify(thing) | |
|
165 | 170 | try: |
|
166 |
return filt( |
|
|
171 | return filt(thing) | |
|
167 | 172 | except (ValueError, AttributeError, TypeError): |
|
168 | 173 | if isinstance(data, tuple): |
|
169 | 174 | dt = data[1] |
@@ -1901,6 +1901,11 b' Thrown an error if a template function d' | |||
|
1901 | 1901 | hg: parse error: unknown function 'foo' |
|
1902 | 1902 | [255] |
|
1903 | 1903 | |
|
1904 | Pass generator object created by template function to filter | |
|
1905 | ||
|
1906 | $ hg log -l 1 --template '{if(author, author)|user}\n' | |
|
1907 | test | |
|
1908 | ||
|
1904 | 1909 | Test diff function: |
|
1905 | 1910 | |
|
1906 | 1911 | $ hg diff -c 8 |
General Comments 0
You need to be logged in to leave comments.
Login now