diff mercurial/cmdutil.py @ 4734:9ac493f12901

Abort if earlygetopt fails to detect an option. Otherwise it could happen that a command is used on the wrong repository, because abbreviations of --cwd or --repository were ignored.
author Thomas Arendsen Hein <thomas@intevation.de>
date Thu, 28 Jun 2007 16:03:45 +0200
parents 0ecfc3b3f072
children f3f84d5cd268
line wrap: on
line diff
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -318,6 +318,15 @@ def dispatch(ui, args, argv0=None):
     fullargs = args
     cmd, func, args, options, cmdoptions = parse(ui, args)
 
+    if options["config"]:
+        raise util.Abort(_("Option --config may not be abbreviated!"))
+    if options["cwd"]:
+        raise util.Abort(_("Option --cwd may not be abbreviated!"))
+    if options["repository"]:
+        raise util.Abort(_(
+            "Option -R has to be separated from other options (i.e. not -qR) "
+            "and --repository may only be abbreviated as --repo!"))
+
     if options["encoding"]:
         util._encoding = options["encoding"]
     if options["encodingmode"]: