[PATCH stable] templatefilters: add missing import of _

Mads Kiilerich mads at kiilerich.com
Tue Feb 26 05:25:08 CST 2013


On 02/26/2013 06:14 AM, Kevin Bullock wrote:
> On 25 Feb 2013, at 8:39 PM, Mads Kiilerich wrote:
>
>> # HG changeset patch
>> # User Mads Kiilerich <madski at unity3d.com>
>> # Date 1361844560 -3600
>> # Branch stable
>> # Node ID b1f0fd26bda704357708c73fdeb78f1b6f372238
>> # Parent  61c8327ced503bf7a1996337af711e0f4a58d4c0
>> templatefilters: add missing import of _
>>
>> diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py
>> --- a/mercurial/templatefilters.py
>> +++ b/mercurial/templatefilters.py
>> @@ -5,6 +5,7 @@
>> # This software may be used and distributed according to the terms of the
>> # GNU General Public License version 2 or any later version.
>>
>> +from i18n import _
>> import cgi, re, os, time, urllib
>> import encoding, node, util, error
>> import hbisect
>> diff --git a/tests/test-template-engine.t b/tests/test-template-engine.t
>> --- a/tests/test-template-engine.t
>> +++ b/tests/test-template-engine.t
>> @@ -44,4 +44,15 @@
>>    0 97e5f848f0936960273bbf75be6388cd0350a32b -1 0000000000000000000000000000000000000000
>>    -1 0000000000000000000000000000000000000000 -1 0000000000000000000000000000000000000000
>>
>> +  $ hg tip --template '{fill(node, 7)}\n'
>> +  hg: parse error: fill expects an integer width
>> +  [255]
>> +  $ hg tip --template '{fill(node, "7")}\n'
>> +  ef4a3af
>> +  ceb5370
>> +  e8500df
>> +  6f7b191
>> +  e48998e
>> +  059af
>> +
>>    $ cd ..
> I'm confused what this test has to do with the code change.

The test is testing the code change.

The original code was added without test coverage (and without 
documentation).

The new tests gives _some_ test coverage of this code so this exact 
problem won't happen again.

It is very surprising that the fill width can't be specified as an 
integer but has to be a string (especially given the error message), so 
it would be very misleading just to add a test that showed that now it 
knew how to fail.

/Mads



More information about the Mercurial-devel mailing list