OLD | NEW |
1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import atexit | 5 import atexit |
6 import cgi | 6 import cgi |
7 import ConfigParser | 7 import ConfigParser |
8 import json | 8 import json |
9 import os | 9 import os |
10 import Queue | 10 import Queue |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 # Normalize the path by stripping everything off the component's relative | 217 # Normalize the path by stripping everything off the component's relative |
218 # path. | 218 # path. |
219 normalized_path = normalized_path.split(current_component_path, 1)[1] | 219 normalized_path = normalized_path.split(current_component_path, 1)[1] |
220 lower_normalized_path = normalized_path.lower() | 220 lower_normalized_path = normalized_path.lower() |
221 | 221 |
222 # Add 'src/' or 'Source/' at the front of the normalized path, depending | 222 # Add 'src/' or 'Source/' at the front of the normalized path, depending |
223 # on what prefix the component path uses. For example, blink uses | 223 # on what prefix the component path uses. For example, blink uses |
224 # 'Source' but chromium uses 'src/', and blink component path is | 224 # 'Source' but chromium uses 'src/', and blink component path is |
225 # 'src/third_party/WebKit/Source', so add 'Source/' in front of the | 225 # 'src/third_party/WebKit/Source', so add 'Source/' in front of the |
226 # normalized path. | 226 # normalized path. |
227 if not (lower_normalized_path.startswith('src/') or | 227 if (lower_component_path == 'src/third_party/webkit/source' and |
228 lower_normalized_path.startswith('source/')): | 228 not lower_normalized_path.startswith('source/')): |
229 | |
230 if (lower_component_path.endswith('src/') or | |
231 lower_component_path.endswith('source/')): | |
232 normalized_path = (current_component_path.split('/')[-2] + '/' + | 229 normalized_path = (current_component_path.split('/')[-2] + '/' + |
233 normalized_path) | 230 normalized_path) |
234 | 231 |
235 else: | |
236 normalized_path = 'src/' + normalized_path | |
237 | |
238 component_name = parsed_deps[component_path]['name'] | 232 component_name = parsed_deps[component_path]['name'] |
239 | 233 |
240 return (component_path, component_name, normalized_path) | 234 return (component_path, component_name, normalized_path) |
241 | 235 |
242 # If the path does not match any component, default to chromium. | 236 # If the path does not match any component, default to chromium. |
243 return ('src/', 'chromium', normalized_path) | 237 return ('src/', 'chromium', normalized_path) |
244 | 238 |
245 | 239 |
246 def SplitRange(regression): | 240 def SplitRange(regression): |
247 """Splits a range as retrieved from clusterfuzz. | 241 """Splits a range as retrieved from clusterfuzz. |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 A list of result object. | 515 A list of result object. |
522 | 516 |
523 """ | 517 """ |
524 result_list = [] | 518 result_list = [] |
525 | 519 |
526 for _, cl, match in matches: | 520 for _, cl, match in matches: |
527 suspected_cl = cl | 521 suspected_cl = cl |
528 revision_url = match.revision_url | 522 revision_url = match.revision_url |
529 component_name = match.component_name | 523 component_name = match.component_name |
530 author = match.author | 524 author = match.author |
531 reason = match.reason | 525 reason = match.reason.strip() |
532 review_url = match.review_url | 526 review_url = match.review_url |
533 reviewers = match.reviewers | 527 reviewers = match.reviewers |
534 # For matches, line content do not exist. | 528 # For matches, line content do not exist. |
535 line_content = None | 529 line_content = None |
536 message = match.message | 530 message = match.message |
| 531 time = match.time |
537 | 532 |
538 result = Result(suspected_cl, revision_url, component_name, author, reason, | 533 result = Result(suspected_cl, revision_url, component_name, author, reason, |
539 review_url, reviewers, line_content, message) | 534 review_url, reviewers, line_content, message, time) |
540 result_list.append(result) | 535 result_list.append(result) |
541 | 536 |
542 return result_list | 537 return result_list |
543 | 538 |
544 | 539 |
545 def BlameListToResultList(blame_list): | 540 def BlameListToResultList(blame_list): |
546 """Convert blame list to the list of result objects. | 541 """Convert blame list to the list of result objects. |
547 | 542 |
548 Args: | 543 Args: |
549 blame_list: A list of blame objects. | 544 blame_list: A list of blame objects. |
550 | 545 |
551 Returns: | 546 Returns: |
552 A list of result objects. | 547 A list of result objects. |
553 """ | 548 """ |
554 result_list = [] | 549 result_list = [] |
555 | 550 |
556 for blame in blame_list: | 551 for blame in blame_list: |
557 suspected_cl = blame.revision | 552 suspected_cl = blame.revision |
558 revision_url = blame.url | 553 revision_url = blame.url |
559 component_name = blame.component_name | 554 component_name = blame.component_name |
560 author = blame.author | 555 author = blame.author |
561 reason = ( | 556 reason = ( |
562 'The CL last changed line %s of file %s, which is stack frame %d.' % | 557 'The CL last changed line %s of file %s, which is stack frame %d.' % |
563 (blame.line_number, blame.file, blame.stack_frame_index)) | 558 (blame.line_number, blame.file, blame.stack_frame_index)) |
| 559 time = blame.time |
564 # Blame object does not have review url and reviewers. | 560 # Blame object does not have review url and reviewers. |
565 review_url = None | 561 review_url = None |
566 reviewers = None | 562 reviewers = None |
567 line_content = blame.line_content | 563 line_content = blame.line_content |
568 message = blame.message | 564 message = blame.message |
569 | 565 |
570 result = Result(suspected_cl, revision_url, component_name, author, reason, | 566 result = Result(suspected_cl, revision_url, component_name, author, reason, |
571 review_url, reviewers, line_content, message) | 567 review_url, reviewers, line_content, message, time) |
572 result_list.append(result) | 568 result_list.append(result) |
573 | 569 |
574 return result_list | 570 return result_list |
OLD | NEW |