help: enable listing of a subset of the command list
Instead of giving the "command %s is ambiguous" error message
with a bare list of possible command, display help list
for all commands starting with the given string.
--- a/mercurial/commands.py Fri Jun 06 18:31:57 2008 +0200
+++ b/mercurial/commands.py Sat Jun 07 09:49:34 2008 +0200
@@ -1253,7 +1253,14 @@
if with_version:
version_(ui)
ui.write('\n')
- aliases, i = cmdutil.findcmd(ui, name, table)
+
+ try:
+ aliases, i = cmdutil.findcmd(ui, name, table)
+ except cmdutil.AmbiguousCommand, inst:
+ select = lambda c: c.lstrip('^').startswith(inst.args[0])
+ helplist(_('list of commands:\n\n'), select)
+ return
+
# synopsis
ui.write("%s\n" % i[2])