changeset 252:5eda6c542978

Handle unknown commands nicely -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Handle unknown commands nicely manifest hash: 787091fe5d983cdcd12491daaaf3cf60e9e950cc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCojXfywK+sNU5EO8RAlniAJ4gow9qBZ80Rvv8J3Rp8Ow2J/HOzwCglI3z Ra50GpqCglTuqWvPcBNfdMQ= =2s1i -----END PGP SIGNATURE-----
author mpm@selenic.com
date Sat, 04 Jun 2005 15:14:39 -0800
parents 3fd8fc14b12f
children 2da0a56aa1fd
files mercurial/commands.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Jun 04 15:14:11 2005 -0800
+++ b/mercurial/commands.py	Sat Jun 04 15:14:39 2005 -0800
@@ -75,7 +75,7 @@
             ui.write("%s\n\n" % i[2])
             ui.write(i[0].__doc__, "\n")
         except UnknownCommand:
-            ui.warn("unknown command %s", cmd)
+            ui.warn("unknown command %s" % cmd)
         sys.exit(0)
     
     ui.status("""\
@@ -551,8 +551,12 @@
     u = ui.ui(options["verbose"], options["debug"], options["quiet"],
            not options["noninteractive"])
 
-    # deal with unfound commands later
-    i = find(cmd)
+    try:
+        i = find(cmd)
+    except UnknownCommand:
+        u.warn("unknown command '%s'\n" % cmd)
+        help(u)
+        sys.exit(1)
 
     signal.signal(signal.SIGTERM, catchterm)