[PATCH 1 of 2] templates/filters: add 'stripquote' filter

Yann E. MORIN yann.morin.1998 at free.fr
Sun Mar 4 18:21:39 CST 2012


Matt, All,

On Monday 05 March 2012 00:45:11 Matt Mackall wrote:
> On Thu, 2012-03-01 at 00:39 +0100, Yann E. MORIN wrote:
> > # HG changeset patch
> > # User "Yann E. MORIN" <yann.morin.1998 at free.fr>
> > # Date 1329262818 -3600
> > # Node ID 03bbe66e40ad60efb9e9042cdd4d471d296941ff
> > # Parent  a4413624d0146f1edaa712a32c36c3409209ed6a
> > templates/filters: add 'stripquote' filter
[--SNIP--]
> > Given this author: "J. DOE" <john at doe.net>
> >     {author|person}             : "J. DOE"
> >     {author|person|stripquote}  : J. DOE
> 
> I would have guessed that the reason for not just fixing the person
> filter would be to preserve backward compatibility.. but then you go and
> change the stock command-line templates, which contradicts that goal.
> 
> Absent an argument as to why changing the command line output is safe
> for all the stupid scripts in the world (could they already be doing
> author = author[1:-1]?), you should avoid touching it. 
> 
> But if you do have such an argument, it should probably just be rolled
> into the person filter.

On one hand, I believe the current behavior should not change, so as users
do not get confused, and existing infrastructures do not break.

On the other hand, I think the current behavior is broken, because it is
non-conformant to standards, so it should be fixed.

And I really can not decide which is the best. :-/

But in any case, you are right: either we keep the 'stripquote' filter, or
we fix the 'person' filter, dropping the second patch in any case.

Which do you want, keep or fix? I'll follow your decision to adapt the
patchset.

> Please use a doctest for testing simple functions, it has orders of
> magnitude less overhead per test:
> 
> http://mercurial.selenic.com/wiki/WritingTests#Writing_a_Python_doctest

You mean, instead of the tests in 'tests/test-command-template.t' ?

I am not a Python developper. I merely observe what is already done in the
code, and adapt to fit my needs. Granted, that can lead to sub-optimal
solutions, but that's the best I can do without dedicating a long time to
learn Python in details.

I'll look at this doctest stuff to see how it works. Thank you! :-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'


More information about the Mercurial-devel mailing list