D114: run-tests: pass color option via options object, not global var
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Jul 18 00:06:09 UTC 2017
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
There are already other attributes on the options object that are not
directly outputs from command line parsing, so this doesn't seem too
bad to me.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D114
AFFECTED FILES
tests/run-tests.py
CHANGE DETAILS
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -416,12 +416,12 @@
parser.error('--chg does not work when --with-hg is specified '
'(use --with-chg instead)')
- global with_color
- if options.color != 'auto':
- if options.color == 'never':
- with_color = False
- else: # 'always', for testing purposes
- with_color = True
+ if options.color == 'auto':
+ options.color = with_color
+ elif options.color == 'never':
+ options.color = False
+ else: # 'always', for testing purposes
+ options.color = True
global useipv6
if options.ipv6:
@@ -1651,7 +1651,7 @@
else:
self.stream.write('\n')
for line in lines:
- if with_color and pygmentspresent:
+ if self._options.color and pygmentspresent:
line = pygments.highlight(
line,
lexers.DiffLexer(),
EMAIL PREFERENCES
https://phab.mercurial-scm.org/settings/panel/emailpreferences/
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list