mercurial/commands.py
changeset 3346 1700a103458e
parent 3345 a09be4317f9c
child 3348 e4aa22eaa0e4
--- a/mercurial/commands.py	Tue Oct 10 18:43:20 2006 -0300
+++ b/mercurial/commands.py	Tue Oct 10 18:43:20 2006 -0300
@@ -3275,6 +3275,20 @@
                 ui.warn(_("module %s overrides %s\n") % (name, t))
         table.update(cmdtable)
 
+def parseconfig(config):
+    """parse the --config options from the command line"""
+    parsed = []
+    for cfg in config:
+        try:
+            name, value = cfg.split('=', 1)
+            section, name = name.split('.', 1)
+            if not section or not name:
+                raise IndexError
+            parsed.append((section, name, value))
+        except (IndexError, ValueError):
+            raise util.Abort(_('malformed --config option: %s') % cfg)
+    return parsed
+
 def dispatch(args):
     for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM':
         num = getattr(signal, name, None)
@@ -3306,7 +3320,7 @@
 
         u.updateopts(options["verbose"], options["debug"], options["quiet"],
                      not options["noninteractive"], options["traceback"],
-                     options["config"])
+                     parseconfig(options["config"]))
 
         # enter the debugger before command execution
         if options['debugger']: