--- a/mercurial/dispatch.py Thu Apr 23 15:40:10 2009 -0500
+++ b/mercurial/dispatch.py Thu Apr 23 15:40:10 2009 -0500
@@ -198,19 +198,17 @@
return (cmd, cmd and i[0] or None, args, options, cmdoptions)
-def _parseconfig(config):
+def _parseconfig(ui, 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))
+ ui.setconfig(section, name, value)
except (IndexError, ValueError):
raise util.Abort(_('malformed --config option: %s') % cfg)
- return parsed
def _earlygetopt(aliases, args):
"""Return list of values for an option (or aliases).
@@ -256,9 +254,7 @@
def _dispatch(ui, args):
# read --config before doing anything else
# (e.g. to change trust settings for reading .hg/hgrc)
- config = _earlygetopt(['--config'], args)
- if config:
- ui.updateopts(_parseconfig(config))
+ _parseconfig(ui, _earlygetopt(['--config'], args))
# check for cwd
cwd = _earlygetopt(['--cwd'], args)
--- a/mercurial/ui.py Thu Apr 23 15:40:10 2009 -0500
+++ b/mercurial/ui.py Thu Apr 23 15:40:10 2009 -0500
@@ -66,10 +66,6 @@
ui._isatty = False
return ui._isatty
- def updateopts(self, config):
- for section, name, value in config:
- self.setconfig(section, name, value)
-
def verbosity_constraints(self):
self.quiet = self.configbool('ui', 'quiet')
self.verbose = self.configbool('ui', 'verbose')
--- a/tests/test-ui-config Thu Apr 23 15:40:10 2009 -0500
+++ b/tests/test-ui-config Thu Apr 23 15:40:10 2009 -0500
@@ -4,7 +4,7 @@
from mercurial import ui, util, dispatch
testui = ui.ui()
-parsed = dispatch._parseconfig([
+parsed = dispatch._parseconfig(testui, [
'values.string=string value',
'values.bool1=true',
'values.bool2=false',
@@ -18,7 +18,6 @@
'interpolation.value4=%(bad)1',
'interpolation.value5=%bad2',
])
-testui.updateopts(config=parsed)
print repr(testui.configitems('values'))
print repr(testui.configitems('lists'))