Mercurial > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
2292:903ab41ac7eb | 2293:3dc6f2501dbc |
---|---|
45 | 45 |
46 def __getattr__(self, key): | 46 def __getattr__(self, key): |
47 return getattr(self.parentui, key) | 47 return getattr(self.parentui, key) |
48 | 48 |
49 def updateopts(self, verbose=False, debug=False, quiet=False, | 49 def updateopts(self, verbose=False, debug=False, quiet=False, |
50 interactive=True, traceback=False): | 50 interactive=True, traceback=False, config=[]): |
51 self.quiet = (self.quiet or quiet) and not verbose and not debug | 51 self.quiet = (self.quiet or quiet) and not verbose and not debug |
52 self.verbose = (self.verbose or verbose) or debug | 52 self.verbose = (self.verbose or verbose) or debug |
53 self.debugflag = (self.debugflag or debug) | 53 self.debugflag = (self.debugflag or debug) |
54 self.interactive = (self.interactive and interactive) | 54 self.interactive = (self.interactive and interactive) |
55 self.traceback = self.traceback or traceback | 55 self.traceback = self.traceback or traceback |
56 for cfg in config: | |
57 try: | |
58 name, value = cfg.split('=', 1) | |
59 section, name = name.split('.', 1) | |
60 if not self.cdata.has_section(section): | |
61 self.cdata.add_section(section) | |
62 if not section or not name: | |
63 raise IndexError | |
64 self.cdata.set(section, name, value) | |
65 except (IndexError, ValueError): | |
66 raise util.Abort(_('malformed --config option: %s') % cfg) | |
56 | 67 |
57 def readconfig(self, fn, root=None): | 68 def readconfig(self, fn, root=None): |
58 if isinstance(fn, basestring): | 69 if isinstance(fn, basestring): |
59 fn = [fn] | 70 fn = [fn] |
60 for f in fn: | 71 for f in fn: |