Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 13849:9f97de157aad
HGPLAIN: allow exceptions to plain mode, like i18n, via HGPLAINEXCEPT
This makes it possible to gain the benefits of HGPLAIN for scripting
while preserving different behaviors like internationalization.
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Wed, 05 Jan 2011 00:18:36 +1100 |
parents | f1823b9f073b |
children | af60153b5e3b |
comparison
equal
deleted
inserted
replaced
13848:b2798c1defff | 13849:9f97de157aad |
---|---|
276 yield section, name, value | 276 yield section, name, value |
277 | 277 |
278 def plain(self): | 278 def plain(self): |
279 '''is plain mode active? | 279 '''is plain mode active? |
280 | 280 |
281 Plain mode means that all configuration variables which affect the | 281 Plain mode means that all configuration variables which affect |
282 behavior and output of Mercurial should be ignored. Additionally, the | 282 the behavior and output of Mercurial should be |
283 output should be stable, reproducible and suitable for use in scripts or | 283 ignored. Additionally, the output should be stable, |
284 applications. | 284 reproducible and suitable for use in scripts or applications. |
285 | 285 |
286 The only way to trigger plain mode is by setting the `HGPLAIN' | 286 The only way to trigger plain mode is by setting either the |
287 environment variable. | 287 `HGPLAIN' or `HGPLAINEXCEPT' environment variables. |
288 ''' | 288 |
289 return 'HGPLAIN' in os.environ | 289 The return value can either be False, True, or a list of |
290 features that plain mode should not apply to (e.g., i18n, | |
291 progress, etc). | |
292 ''' | |
293 if 'HGPLAIN' not in os.environ and 'HGPLAINEXCEPT' not in os.environ: | |
294 return False | |
295 exceptions = os.environ.get('HGPLAINEXCEPT', '').strip().split(',') | |
296 return exceptions or True | |
290 | 297 |
291 def username(self): | 298 def username(self): |
292 """Return default username to be used in commits. | 299 """Return default username to be used in commits. |
293 | 300 |
294 Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL | 301 Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL |