OLD | NEW |
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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 318 |
319 Args: | 319 Args: |
320 control_url, roll_url: (strings) URL of the format | 320 control_url, roll_url: (strings) URL of the format |
321 https://codereview.chromium.org/????????? | 321 https://codereview.chromium.org/????????? |
322 | 322 |
323 verbosity: (int) verbose level. 0, 1, or 2. | 323 verbosity: (int) verbose level. 0, 1, or 2. |
324 """ | 324 """ |
325 # pylint: disable=I0011,R0914,R0912 | 325 # pylint: disable=I0011,R0914,R0912 |
326 control = CodeReviewHTMLParser.parse(control_url) | 326 control = CodeReviewHTMLParser.parse(control_url) |
327 roll = CodeReviewHTMLParser.parse(roll_url) | 327 roll = CodeReviewHTMLParser.parse(roll_url) |
328 if not (control and roll): | 328 all_bots = set(control) & set(roll) # Set intersection. |
| 329 if not all_bots: |
| 330 print >> sys.stderr, ( |
| 331 'Error: control %s and roll %s have no common trybots.' |
| 332 % (list(control), list(roll))) |
329 return | 333 return |
330 | 334 |
331 control_name = '[control %s]' % control_url.split('/')[-1] | 335 control_name = '[control %s]' % control_url.split('/')[-1] |
332 roll_name = '[roll %s]' % roll_url.split('/')[-1] | 336 roll_name = '[roll %s]' % roll_url.split('/')[-1] |
333 all_bots = set(control) & set(roll) # Set intersection. | |
334 | 337 |
335 out = sys.stdout | 338 out = sys.stdout |
336 if verbosity > 0: | 339 if verbosity > 0: |
337 # Print out summary of all of the bots. | 340 # Print out summary of all of the bots. |
338 out.write('%11s %11s %4s %s\n\n' % | 341 out.write('%11s %11s %4s %s\n\n' % |
339 ('CONTROL', 'ROLL', 'DIFF', 'BOT')) | 342 ('CONTROL', 'ROLL', 'DIFF', 'BOT')) |
340 for bot in sorted(all_bots): | 343 for bot in sorted(all_bots): |
341 if control[bot].status != roll[bot].status: | 344 if control[bot].status != roll[bot].status: |
342 diff = '****' | 345 diff = '****' |
343 elif (control[bot].status != 'success' or | 346 elif (control[bot].status != 'success' or |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 out.write('\n') | 381 out.write('\n') |
379 | 382 |
380 | 383 |
381 if __name__ == '__main__': | 384 if __name__ == '__main__': |
382 if len(sys.argv) < 3: | 385 if len(sys.argv) < 3: |
383 print >> sys.stderr, __doc__ | 386 print >> sys.stderr, __doc__ |
384 exit(1) | 387 exit(1) |
385 main(sys.argv[1], sys.argv[2], | 388 main(sys.argv[1], sys.argv[2], |
386 int(os.environ.get('COMPARE_CODEREVIEW_VERBOSITY', 1))) | 389 int(os.environ.get('COMPARE_CODEREVIEW_VERBOSITY', 1))) |
387 | 390 |
OLD | NEW |