Mercurial > public > mercurial-scm > hg-stable
diff mercurial/ui.py @ 2293:3dc6f2501dbc
add --config global option. allows to set hgrc option on command line.
syntax: --config section.name=value
also add new test-globalopts to test all global options in one place.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Mon, 15 May 2006 11:16:32 -0700 |
parents | 903ab41ac7eb |
children | f0680b2d1d64 |
line wrap: on
line diff
--- a/mercurial/ui.py Mon May 15 10:25:17 2006 -0700 +++ b/mercurial/ui.py Mon May 15 11:16:32 2006 -0700 @@ -47,12 +47,23 @@ return getattr(self.parentui, key) def updateopts(self, verbose=False, debug=False, quiet=False, - interactive=True, traceback=False): + interactive=True, traceback=False, config=[]): self.quiet = (self.quiet or quiet) and not verbose and not debug self.verbose = (self.verbose or verbose) or debug self.debugflag = (self.debugflag or debug) self.interactive = (self.interactive and interactive) self.traceback = self.traceback or traceback + for cfg in config: + try: + name, value = cfg.split('=', 1) + section, name = name.split('.', 1) + if not self.cdata.has_section(section): + self.cdata.add_section(section) + if not section or not name: + raise IndexError + self.cdata.set(section, name, value) + except (IndexError, ValueError): + raise util.Abort(_('malformed --config option: %s') % cfg) def readconfig(self, fn, root=None): if isinstance(fn, basestring):