Mercurial > public > mercurial-scm > hg
diff mercurial/ui.py @ 10455:40dfd46d098f
ui: add HGPLAIN environment variable for easier scripting
If HGPLAIN is set, the following settings are ignored when read from
hgrc files:
- ui.debug
- ui.fallbackencoding
- ui.quiet
- ui.traceback
- ui.verbose
- defaults.*
Localization is also disabled.
Equivalent options set via command line are honored.
author | Brodie Rao <me+hg@dackz.net> |
---|---|
date | Sun, 07 Feb 2010 14:56:18 +0100 |
parents | 5a3a916aad58 |
children | 42afde35e9f7 |
line wrap: on
line diff
--- a/mercurial/ui.py Sat Feb 13 23:24:27 2010 -0600 +++ b/mercurial/ui.py Sun Feb 07 14:56:18 2010 +0100 @@ -79,6 +79,14 @@ raise self.warn(_("Ignored: %s\n") % str(inst)) + if self.plain(): + for k in ('debug', 'fallbackencoding', 'quiet', 'traceback', + 'verbose'): + if k in cfg['ui']: + del cfg['ui'][k] + for k, v in cfg.items('defaults'): + del cfg['defaults'][k] + if trusted: self._tcfg.update(cfg) self._tcfg.update(self._ocfg) @@ -169,6 +177,9 @@ for name, value in self.configitems(section, untrusted): yield section, name, str(value).replace('\n', '\\n') + def plain(self): + return 'HGPLAIN' in os.environ + def username(self): """Return default username to be used in commits.