| 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 re | 5 import re |
| 6 | 6 |
| 7 from threading import Lock | 7 from threading import Lock |
| 8 | 8 |
| 9 import crash_utils | 9 import crash_utils |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 component_name: The name of the component that this CL belongs to. | 32 component_name: The name of the component that this CL belongs to. |
| 33 stack_frame_indices: For files that caused crash, list of where in the | 33 stack_frame_indices: For files that caused crash, list of where in the |
| 34 stackframe they occur. | 34 stackframe they occur. |
| 35 priorities: A list of priorities for each of the changed file. A priority | 35 priorities: A list of priorities for each of the changed file. A priority |
| 36 is 1 if the file changes a crashed line, and 2 if it changes | 36 is 1 if the file changes a crashed line, and 2 if it changes |
| 37 the file but not the crashed line. | 37 the file but not the crashed line. |
| 38 reivision_url: The revision URL of the CL. | 38 reivision_url: The revision URL of the CL. |
| 39 review_url: The codereview URL that reviews this CL. | 39 review_url: The codereview URL that reviews this CL. |
| 40 reviewers: The list of people that reviewed this CL. | 40 reviewers: The list of people that reviewed this CL. |
| 41 reason: The reason why this CL is suspected. | 41 reason: The reason why this CL is suspected. |
| 42 time: When this CL was committed. |
| 42 """ | 43 """ |
| 43 REVERT_PATTERN = re.compile(r'(revert\w*) r?(\d+)', re.I) | 44 REVERT_PATTERN = re.compile(r'(revert\w*) r?(\d+)', re.I) |
| 44 | 45 |
| 45 def __init__(self, revision, component_name): | 46 def __init__(self, revision, component_name): |
| 46 self.is_revert = False | 47 self.is_revert = False |
| 47 self.revert_of = None | 48 self.revert_of = None |
| 48 self.message = None | 49 self.message = None |
| 49 self.crashed_line_numbers = [] | 50 self.crashed_line_numbers = [] |
| 50 self.function_list = [] | 51 self.function_list = [] |
| 51 self.min_distance = crash_utils.INFINITY | 52 self.min_distance = crash_utils.INFINITY |
| 52 self.min_distance_info = None | 53 self.min_distance_info = None |
| 53 self.changed_files = [] | 54 self.changed_files = [] |
| 54 self.changed_file_urls = [] | 55 self.changed_file_urls = [] |
| 55 self.author = revision['author'] | 56 self.author = revision['author'] |
| 56 self.component_name = component_name | 57 self.component_name = component_name |
| 57 self.stack_frame_indices = [] | 58 self.stack_frame_indices = [] |
| 58 self.priorities = [] | 59 self.priorities = [] |
| 59 self.revision_url = revision['url'] | 60 self.revision_url = revision['url'] |
| 60 self.review_url = '' | 61 self.review_url = '' |
| 61 self.reviewers = [] | 62 self.reviewers = [] |
| 62 self.reason = None | 63 self.reason = None |
| 64 self.time = revision['time'] |
| 63 | 65 |
| 64 def ParseMessage(self, message, codereview_api_url): | 66 def ParseMessage(self, message, codereview_api_url): |
| 65 """Parses the message. | 67 """Parses the message. |
| 66 | 68 |
| 67 It checks the message to extract the code review website and list of | 69 It checks the message to extract the code review website and list of |
| 68 reviewers, and it also checks if the CL is a revert of another CL. | 70 reviewers, and it also checks if the CL is a revert of another CL. |
| 69 | 71 |
| 70 Args: | 72 Args: |
| 71 message: The message to parse. | 73 message: The message to parse. |
| 72 codereview_api_url: URL to retrieve codereview data from. | 74 codereview_api_url: URL to retrieve codereview data from. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 self.codereview_api_url = codereview_api_url | 119 self.codereview_api_url = codereview_api_url |
| 118 self.matches = {} | 120 self.matches = {} |
| 119 self.cls_to_ignore = set() | 121 self.cls_to_ignore = set() |
| 120 self.matches_lock = Lock() | 122 self.matches_lock = Lock() |
| 121 | 123 |
| 122 def RemoveRevertedCLs(self): | 124 def RemoveRevertedCLs(self): |
| 123 """Removes CLs that are revert.""" | 125 """Removes CLs that are revert.""" |
| 124 for cl in self.matches: | 126 for cl in self.matches: |
| 125 if cl in self.cls_to_ignore: | 127 if cl in self.cls_to_ignore: |
| 126 del self.matches[cl] | 128 del self.matches[cl] |
| OLD | NEW |