[PATCH stable] templatefilters: add missing import of _

Mads Kiilerich mads at kiilerich.com
Tue Feb 26 12:11:40 CST 2013


On 02/26/2013 05:38 PM, Kevin Bullock wrote:
> On Feb 26, 2013, at 5:25 AM, Mads Kiilerich wrote:
>
>> 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).
> Eh? How does adding a missing import of _ fix the fill() function? (This should be in the commit description.)

It is really so trivial that it doesn't deserve a description.

When an import is added because it was missing then it is obviously 
because some code uses it.

When a test is added then it is obviously because it exercises the code 
path that failed without the fix and proves that it no longer fails.

Please, let's get the proportions right and save the long explanations 
to stuff that really needs an explanation.

/Mads



More information about the Mercurial-devel mailing list