# HG changeset patch # User Matt Mackall # Date 1316288773 18000 # Node ID 2c80862728cb415018fa4c2754926cae34d828ed # Parent d3ad0e9d4be28dc446c10669324d16eb4a624c58 help: fold header selection into helplist diff -r d3ad0e9d4be2 -r 2c80862728cb mercurial/commands.py --- a/mercurial/commands.py Sat Sep 17 14:46:00 2011 -0500 +++ b/mercurial/commands.py Sat Sep 17 14:46:13 2011 -0500 @@ -2747,7 +2747,7 @@ # except block, nor can be used inside a lambda. python issue4617 prefix = inst.args[0] select = lambda c: c.lstrip('^').startswith(prefix) - helplist(_('list of commands:\n\n'), select) + helplist(select) return # check if it's an invalid alias and display its error if it is @@ -2805,7 +2805,13 @@ except KeyError: pass - def helplist(header, select=None): + def helplist(select=None): + # list of commands + if name == "shortlist": + header = _('basic commands:\n\n') + else: + header = _('list of commands:\n\n') + h = {} cmds = {} for c, e in table.iteritems(): @@ -2908,7 +2914,7 @@ except AttributeError: ct = {} modcmds = set([c.split('|', 1)[0] for c in ct]) - helplist(_('list of commands:\n\n'), modcmds.__contains__) + helplist(modcmds.__contains__) else: ui.write(_('use "hg help extensions" for information on enabling ' 'extensions\n')) @@ -2943,19 +2949,11 @@ i = inst if i: raise i - else: # program name ui.status(_("Mercurial Distributed SCM\n")) ui.status('\n') - - # list of commands - if name == "shortlist": - header = _('basic commands:\n\n') - else: - header = _('list of commands:\n\n') - - helplist(header) + helplist() ui.write(opttext(optlist, textwidth))