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