[PATCH 2 of 2] templater: add nonempty function with an extra argument placeholder

Alexander Plavin me at aplavin.ru
Wed Jul 10 05:32:02 CDT 2013


2013/7/10 Kevin Bullock <kbullock+mercurial at ringworld.org>:
> On 1 Jul 2013, at 2:55 PM, Alexander Plavin wrote:
>
>> 2013/7/1 Matt Mackall <mpm at selenic.com>:
>>> On Sat, 2013-06-29 at 18:02 +0400, Alexander Plavin wrote:
>>>> # HG changeset patch
>>>> # User Alexander Plavin <me at aplavin.ru>
>>>> # Date 1372502211 -14400
>>>> #      Sat Jun 29 14:36:51 2013 +0400
>>>> # Node ID 7e93df87bd7b380bb27c3812285e215774602352
>>>> # Parent  7b9b339fa1ccb512aa220dbdf0c651c28d469317
>>>> templater: add nonempty function with an extra argument placeholder
>>>>
>>>> Behaviour without the extra argument is same as for the existing
>>>> nonempty filter.
>>>
>>> May I please finally call your attention to the if() function?
>>>
>>
>> I know about a similar if() usage, but compare these ones: 'if(<very
>> long expression>, <very long expression (again the same!)>,
>> placeholder)' with 'nonempty(<very long expression>, placeholder)':
>> the second variant doesn't need repeating the first argument.
>
> Sounds reasonable to me, but do you have a specific example?

Now I have no specific example of this (an it isn't going to be used
in my next patches soon), but there were some in previous versions of
my patches related to file view in hgweb (after implementation
strategy changed, this function isn't needed there anymore). However,
this looks like a relatively obvious extension of existent 'nonempty'
filter without arguments.

>
> pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
> Kevin R. Bullock
>


More information about the Mercurial-devel mailing list