Mercurial > hg
comparison tests/run-tests.py @ 21535:ab7e224bc089
run-tests: avoid duplicate code in vlog()
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 09 May 2014 15:55:58 -0700 |
parents | 3ece55d16044 |
children | 92a6b16c9186 |
comparison
equal
deleted
inserted
replaced
21534:3ece55d16044 | 21535:ab7e224bc089 |
---|---|
293 | 293 |
294 return servefail, lines | 294 return servefail, lines |
295 | 295 |
296 verbose = False | 296 verbose = False |
297 def vlog(*msg): | 297 def vlog(*msg): |
298 if verbose is not False: | 298 """Log only when in verbose mode.""" |
299 iolock.acquire() | 299 if verbose is False: |
300 if verbose: | 300 return |
301 print verbose, | 301 |
302 for m in msg: | 302 return log(*msg) |
303 print m, | |
304 print | |
305 sys.stdout.flush() | |
306 iolock.release() | |
307 | 303 |
308 def log(*msg): | 304 def log(*msg): |
305 """Log something to stdout. | |
306 | |
307 Arguments are strings to print. | |
308 """ | |
309 iolock.acquire() | 309 iolock.acquire() |
310 if verbose: | 310 if verbose: |
311 print verbose, | 311 print verbose, |
312 for m in msg: | 312 for m in msg: |
313 print m, | 313 print m, |