##// END OF EJS Templates
run-tests: add a function to colorize a piece of text...
marmoute -
r53409:c2ee1ad7 default
parent child Browse files
Show More
@@ -97,6 +97,7 try: # is pygments installed
97 97 import pygments.formatters as formatters
98 98 import pygments.token as token
99 99 import pygments.style as style
100 from pygments.console import ansiformat
100 101
101 102 if WINDOWS:
102 103 hgpath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -113,8 +114,17 try: # is pygments installed
113 114 pygmentspresent = True
114 115 difflexer = lexers.DiffLexer()
115 116 terminal256formatter = formatters.Terminal256Formatter()
117
118 def colorize(text: str, style: str, color: bool = True) -> str:
119 if not color:
120 return text
121 return ansiformat(style, text)
122
116 123 except ImportError:
117 pass
124
125 def colorize(text: str, style: str, color: bool = True) -> str:
126 return text
127
118 128
119 129 progress_type = {}
120 130
General Comments 0
You need to be logged in to leave comments. Login now