[PATCH 1 of 4] help: enable listing of a subset of the command list

Johannes Stezenbach js at sig21.net
Fri Jun 6 18:00:13 CDT 2008


1 file changed, 6 insertions(+), 1 deletion(-)
mercurial/commands.py |    7 ++++++-


# HG changeset patch
# User Johannes Stezenbach <js at sig21.net>
# Date 1212519204 -7200
# Node ID dde725f3a79c3175f822ce61136730f90a7d3c27
# Parent  92ee960a928dbecd0daaea1b4cc73d24f754a04c
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.

diff -r 92ee960a928d -r dde725f3a79c mercurial/commands.py
--- a/mercurial/commands.py	Thu May 22 13:29:47 2008 +0200
+++ b/mercurial/commands.py	Tue Jun 03 20:53:24 2008 +0200
@@ -1254,7 +1254,12 @@
         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:
+            helplist(_('list of commands:\n\n'), lambda c: c.lstrip('^') in inst.args[1])
+            return
+
         # synopsis
         ui.write("%s\n" % i[2])
 




More information about the Mercurial-devel mailing list