--- a/mercurial/commands.py Thu Jul 19 15:33:21 2007 -0700
+++ b/mercurial/commands.py Thu Jul 19 19:48:24 2007 -0300
@@ -1355,7 +1355,7 @@
addglobalopts(False)
- def helplist(select=None):
+ def helplist(header, select=None):
h = {}
cmds = {}
for c, e in table.items():
@@ -1373,6 +1373,11 @@
h[f] = doc.splitlines(0)[0].rstrip()
cmds[f] = c.lstrip("^")
+ if not h:
+ ui.status(_('no commands defined\n'))
+ return
+
+ ui.status(header)
fns = h.keys()
fns.sort()
m = max(map(len, fns))
@@ -1422,14 +1427,10 @@
try:
ct = mod.cmdtable
except AttributeError:
- ct = None
- if not ct:
- ui.status(_('no commands defined\n'))
- return
-
- ui.status(_('list of commands:\n\n'))
+ ct = {}
+
modcmds = dict.fromkeys([c.split('|', 1)[0] for c in ct])
- helplist(modcmds.has_key)
+ helplist(_('list of commands:\n\n'), modcmds.has_key)
if name and name != 'shortlist':
i = None
@@ -1453,11 +1454,11 @@
# list of commands
if name == "shortlist":
- ui.status(_('basic commands:\n\n'))
+ header = _('basic commands:\n\n')
else:
- ui.status(_('list of commands:\n\n'))
-
- helplist()
+ header = _('list of commands:\n\n')
+
+ helplist(header)
# list all option lists
opt_output = []