##// END OF EJS Templates
ui: test plain mode against exceptions...
"Yann E. MORIN" -
r14372:be0daa0e default
parent child Browse files
Show More
@@ -330,7 +330,7 b' class ui(object):'
330 330 for name, value in self.configitems(section, untrusted):
331 331 yield section, name, value
332 332
333 def plain(self):
333 def plain(self, feature=None):
334 334 '''is plain mode active?
335 335
336 336 Plain mode means that all configuration variables which affect
@@ -341,14 +341,16 b' class ui(object):'
341 341 The only way to trigger plain mode is by setting either the
342 342 `HGPLAIN' or `HGPLAINEXCEPT' environment variables.
343 343
344 The return value can either be False, True, or a list of
345 features that plain mode should not apply to (e.g., i18n,
346 progress, etc).
344 The return value can either be
345 - False if HGPLAIN is not set, or feature is in HGPLAINEXCEPT
346 - True otherwise
347 347 '''
348 348 if 'HGPLAIN' not in os.environ and 'HGPLAINEXCEPT' not in os.environ:
349 349 return False
350 350 exceptions = os.environ.get('HGPLAINEXCEPT', '').strip().split(',')
351 return exceptions or True
351 if feature and exceptions:
352 return feature not in exceptions
353 return True
352 354
353 355 def username(self):
354 356 """Return default username to be used in commits.
@@ -144,7 +144,7 b' plain mode with exceptions'
144 144 $ echo "plain=./plain.py" >> $HGRCPATH
145 145 $ HGPLAINEXCEPT=; export HGPLAINEXCEPT
146 146 $ hg showconfig --config ui.traceback=True --debug
147 plain: ['']
147 plain: True
148 148 read config from: $TESTTMP/hgrc
149 149 $TESTTMP/hgrc:15: extensions.plain=./plain.py
150 150 none: ui.traceback=True
@@ -153,7 +153,7 b' plain mode with exceptions'
153 153 none: ui.quiet=False
154 154 $ unset HGPLAIN
155 155 $ hg showconfig --config ui.traceback=True --debug
156 plain: ['']
156 plain: True
157 157 read config from: $TESTTMP/hgrc
158 158 $TESTTMP/hgrc:15: extensions.plain=./plain.py
159 159 none: ui.traceback=True
@@ -162,7 +162,7 b' plain mode with exceptions'
162 162 none: ui.quiet=False
163 163 $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT
164 164 $ hg showconfig --config ui.traceback=True --debug
165 plain: ['i18n']
165 plain: True
166 166 read config from: $TESTTMP/hgrc
167 167 $TESTTMP/hgrc:15: extensions.plain=./plain.py
168 168 none: ui.traceback=True
General Comments 0
You need to be logged in to leave comments. Login now