[PATCH] help: fix keyword search output for extension commands

Olav Reinert seroton10 at gmail.com
Mon Jun 4 02:24:34 CDT 2012


On 04.06.2012, at 02:11, Mads Kiilerich <mads at kiilerich.com> wrote:

> Olav Reinert wrote, On 06/03/2012 05:49 PM:
>> # HG changeset patch
>> # User Olav Reinert<seroton10 at gmail.com>
>> # Date 1338738544 -7200
>> # Node ID dbba04671f10bfb1b92feb7f703941f5bba71a27
>> # Parent  3183c5039b401a123c6a5ec6bf66a166b86ef34e
>> help: fix keyword search output for extension commands
>> 
>> This patch fixes the help keyword search "hg help -k" to show correct results
>> in the section listing extension commands.
> 
> It would be nice to know which problem it solved.

Help keyword search produces up to four sections of output. One of them, called "extension commands", always contains wrong output. That's the problem. I thought that was what I wrote?

> A test case would perhaps have told what it did when reading beyond the description. Too bad -k is untested - someone should read or watch selected parts of http://nedbatchelder.com/blog/201206/tldw_stop_mocking_start_testing.html ;-)

I agree. Also, even though this patch fixes the content of the extension commands section, it doesn't fix the incorrect formatting.

Once the fate of my other help-related patches is known I can resubmit this patch with tests and the formatting fix.

>> diff -r 3183c5039b40 -r dbba04671f10 mercurial/help.py
>> --- a/mercurial/help.py    Sun Jun 03 17:48:56 2012 +0200
>> +++ b/mercurial/help.py    Sun Jun 03 17:49:04 2012 +0200
>> @@ -105,8 +105,8 @@
>>          for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
>>              if kw in cmd or (len(entry)>  2 and lowercontains(entry[2])):
>>                  cmdname = cmd.split('|')[0].lstrip('^')
>> -                results['extensioncommands'].append(
>> -                    (cmdname, _(getattr(cmd, '__doc__', ''))))
>> +                cmddoc=getattr(mod, '__doc__', '').splitlines()[0]
>> +                results['extensioncommands'].append((cmdname, _(cmddoc)))
>> 
> 
> This adds some localization too.
> LANG=da_DK.utf8 ./hg help -k commit

No, I didn't add localization, it was there before, too.


More information about the Mercurial-devel mailing list