Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(988)

Side by Side Diff: tools/compare_codereview.py

Issue 211233002: Tweak compare_codereview.py. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python2 1 #!/usr/bin/python2
2 2
3 # Copyright 2014 Google Inc. 3 # Copyright 2014 Google Inc.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license that can be 5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file. 6 # found in the LICENSE file.
7 7
8 """Skia's Chromium Codereview Comparison Script. 8 """Skia's Chromium Codereview Comparison Script.
9 9
10 This script takes two Codereview URLs, looks at the trybot results for 10 This script takes two Codereview URLs, looks at the trybot results for
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 if not all_bots: 329 if not all_bots:
330 print >> sys.stderr, ( 330 print >> sys.stderr, (
331 'Error: control %s and roll %s have no common trybots.' 331 'Error: control %s and roll %s have no common trybots.'
332 % (list(control), list(roll))) 332 % (list(control), list(roll)))
333 return 333 return
334 334
335 control_name = '[control %s]' % control_url.split('/')[-1] 335 control_name = '[control %s]' % control_url.split('/')[-1]
336 roll_name = '[roll %s]' % roll_url.split('/')[-1] 336 roll_name = '[roll %s]' % roll_url.split('/')[-1]
337 337
338 out = sys.stdout 338 out = sys.stdout
339 if verbosity > 0:
340 # Print out summary of all of the bots.
341 out.write('%11s %11s %4s %s\n\n' %
342 ('CONTROL', 'ROLL', 'DIFF', 'BOT'))
343 for bot in sorted(all_bots):
344 if control[bot].status != roll[bot].status:
345 diff = '****'
346 elif (control[bot].status != 'success' or
347 roll[bot].status != 'success'):
348 diff = '....'
349 else:
350 diff = ''
351 out.write('%11s %11s %4s %s\n' % (
352 control[bot].status, roll[bot].status, diff, bot))
353 out.write('\n')
354 out.flush()
355 339
356 for bot in sorted(all_bots): 340 for bot in sorted(all_bots):
357 if (roll[bot].status == 'success'): 341 if (roll[bot].status == 'success'):
358 if verbosity > 1: 342 if verbosity > 1:
359 printer(0, '==%s==' % bot) 343 printer(0, '==%s==' % bot)
360 printer(1, 'OK') 344 printer(1, 'OK')
361 continue 345 continue
362 printer(0, '==%s==' % bot) 346 printer(0, '==%s==' % bot)
363 347
364 for (status, name, url) in ( 348 for (status, name, url) in (
365 (control[bot].status, control_name, control[bot].url), 349 (control[bot].status, control_name, control[bot].url),
366 (roll[bot].status, roll_name, roll[bot].url)): 350 (roll[bot].status, roll_name, roll[bot].url)):
367 351
368 if status == 'failure': 352 if status == 'failure':
369 printer(1, name) 353 printer(1, name)
370 results = BuilderHTMLParser.parse(url) 354 results = BuilderHTMLParser.parse(url)
371 for result in results: 355 for result in results:
372 formatted_result = re.sub( 356 formatted_result = re.sub(
373 r'(\S*\.html) ', '\n__\g<1>\n', result.text) 357 r'(\S*\.html) ', '\n__\g<1>\n', result.text)
358 # Strip runtimes.
359 formatted_result = re.sub(r'\(.*\)', '', formatted_result)
374 printer(2, formatted_result) 360 printer(2, formatted_result)
375 if ('compile' in result.text 361 if ('compile' in result.text
376 or '...and more' in result.text): 362 or '...and more' in result.text):
377 printer(3, re.sub('/[^/]*$', '/', url) + result.url) 363 printer(3, re.sub('/[^/]*$', '/', url) + result.url)
378 else: 364 else:
379 printer(1, name) 365 printer(1, name)
380 printer(2, status) 366 printer(2, status)
381 out.write('\n') 367 out.write('\n')
382 368
369 if verbosity > 0:
370 # Print out summary of all of the bots.
371 out.write('%11s %11s %4s %s\n\n' %
372 ('CONTROL', 'ROLL', 'DIFF', 'BOT'))
373 for bot in sorted(all_bots):
374 if roll[bot].status == 'success':
375 diff = ''
376 elif (control[bot].status == 'success' and
377 roll[bot].status == 'failure'):
378 diff = '!!!!'
379 elif ('pending' in control[bot].status or
380 'pending' in roll[bot].status):
381 diff = '....'
382 else:
383 diff = '****'
384 out.write('%11s %11s %4s %s\n' % (
385 control[bot].status, roll[bot].status, diff, bot))
386 out.write('\n')
387 out.flush()
383 388
384 if __name__ == '__main__': 389 if __name__ == '__main__':
385 if len(sys.argv) < 3: 390 if len(sys.argv) < 3:
386 print >> sys.stderr, __doc__ 391 print >> sys.stderr, __doc__
387 exit(1) 392 exit(1)
388 main(sys.argv[1], sys.argv[2], 393 main(sys.argv[1], sys.argv[2],
389 int(os.environ.get('COMPARE_CODEREVIEW_VERBOSITY', 1))) 394 int(os.environ.get('COMPARE_CODEREVIEW_VERBOSITY', 1)))
390 395
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698