| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 _INFINITY = 1000 | 5 _INFINITY = 1000 |
| 6 | 6 |
| 7 | 7 |
| 8 class Result(object): | 8 class Result(object): |
| 9 """Represents findit culprit result.""" | 9 """Represents findit culprit result.""" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 def ToString(self): | 33 def ToString(self): |
| 34 if not self.file_to_stack_infos: | 34 if not self.file_to_stack_infos: |
| 35 return '' | 35 return '' |
| 36 | 36 |
| 37 lines = [] | 37 lines = [] |
| 38 for file_path, stack_infos in self.file_to_stack_infos.iteritems(): | 38 for file_path, stack_infos in self.file_to_stack_infos.iteritems(): |
| 39 line_parts = [] | 39 line_parts = [] |
| 40 for frame, _ in stack_infos: | 40 for frame, _ in stack_infos: |
| 41 line_parts.append('%s (#%d)' % (frame.function, frame.index)) | 41 line_parts.append('%s (#%d)' % (frame.function, frame.index)) |
| 42 | 42 |
| 43 lines.append('Changed file %s which crashed in %s' % ( | 43 lines.append('Changed file %s crashed in %s' % ( |
| 44 file_path, ', '.join(line_parts))) | 44 file_path, ', '.join(line_parts))) |
| 45 | 45 |
| 46 return '\n'.join(lines) | 46 return '\n'.join(lines) |
| 47 | 47 |
| 48 def __str__(self): | 48 def __str__(self): |
| 49 return self.ToString() | 49 return self.ToString() |
| 50 | 50 |
| 51 | 51 |
| 52 class MatchResult(Result): | 52 class MatchResult(Result): |
| 53 """Represents findit culprit result got from match algorithm.""" | 53 """Represents findit culprit result got from match algorithm.""" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 if changelog.revision not in self: | 131 if changelog.revision not in self: |
| 132 # TODO(katesonia): Enable component classifier later. Get it from | 132 # TODO(katesonia): Enable component classifier later. Get it from |
| 133 # file_path and dep_path. | 133 # file_path and dep_path. |
| 134 component = '' | 134 component = '' |
| 135 self[changelog.revision] = MatchResult(changelog, dep_path, component) | 135 self[changelog.revision] = MatchResult(changelog, dep_path, component) |
| 136 | 136 |
| 137 match_result = self[changelog.revision] | 137 match_result = self[changelog.revision] |
| 138 | 138 |
| 139 match_result.Update(file_path, stack_infos, blame) | 139 match_result.Update(file_path, stack_infos, blame) |
| OLD | NEW |