diff mercurial/dispatch.py @ 12748:d10369fefd01

alias: fail gracefully when invalid global options are given (issue2442) This patch modifies the check for shell aliases to prevent crashing when an invalid global option is given. When an invalid global option is given the check will simply return and let the normal error handling for this case happen.
author Steve Losh <steve@stevelosh.com>
date Sun, 17 Oct 2010 13:24:37 -0400
parents 42ca7aef28d3
children 614f0d8724ab
line wrap: on
line diff
--- a/mercurial/dispatch.py	Thu Oct 07 13:44:17 2010 -0700
+++ b/mercurial/dispatch.py	Sun Oct 17 13:24:37 2010 -0400
@@ -433,7 +433,11 @@
     cwd = os.getcwd()
     norepo = commands.norepo
     options = {}
-    args = fancyopts.fancyopts(args, commands.globalopts, options)
+
+    try:
+        args = fancyopts.fancyopts(args, commands.globalopts, options)
+    except fancyopts.getopt.GetoptError:
+        return
 
     if not args:
         return