Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 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 from threading import Lock, Thread | 5 from threading import Lock, Thread |
| 6 | 6 |
| 7 import utils | 7 import utils |
| 8 | 8 |
| 9 | 9 |
| 10 class Blame(object): | 10 class Blame(object): |
| 11 """Represents a blame object. | 11 """Represents a blame object. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 callstack: The list of stack frames. | 67 callstack: The list of stack frames. |
| 68 crash_revision_dict: A dictionary that maps component to its crash | 68 crash_revision_dict: A dictionary that maps component to its crash |
| 69 revision. | 69 revision. |
| 70 regression_dict: A dictionary that maps component to its revision | 70 regression_dict: A dictionary that maps component to its revision |
| 71 range. | 71 range. |
| 72 parsers: A list of two parsers, svn_parser and git_parser | 72 parsers: A list of two parsers, svn_parser and git_parser |
| 73 top_n_frames: A number of stack frames to show the blame result for. | 73 top_n_frames: A number of stack frames to show the blame result for. |
| 74 """ | 74 """ |
| 75 # Only return blame information for first 'top_n_frames' frames. | 75 # Only return blame information for first 'top_n_frames' frames. |
| 76 stack_frames = callstack.GetTopNFrames(top_n_frames) | 76 stack_frames = callstack.GetTopNFrames(top_n_frames) |
| 77 | |
| 78 threads = [] | 77 threads = [] |
| 79 # Iterate through frames in stack. | 78 # Iterate through frames in stack. |
| 80 for stack_frame in stack_frames: | 79 for stack_frame in stack_frames: |
| 81 # If the component this line is from does not have a crash revision, | 80 # If the component this line is from does not have a crash revision, |
| 82 # it is not possible to get blame information, so ignore this line. | 81 # it is not possible to get blame information, so ignore this line. |
| 83 component_path = stack_frame.component_path | 82 component_path = stack_frame.component_path |
| 84 if component_path not in crash_revision_dict: | 83 if component_path not in crash_revision_dict: |
| 85 continue | 84 continue |
| 86 | 85 |
| 87 crash_revision = crash_revision_dict[component_path]['revision'] | 86 crash_revision = crash_revision_dict[component_path]['revision'] |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 | 146 |
| 148 filtered_blame_list = [] | 147 filtered_blame_list = [] |
| 149 | 148 |
| 150 for blame in self.blame_list: | 149 for blame in self.blame_list: |
| 151 # If regression information is available, check if it needs to be | 150 # If regression information is available, check if it needs to be |
| 152 # filtered. | 151 # filtered. |
| 153 if blame.range_start and blame.range_end: | 152 if blame.range_start and blame.range_end: |
| 154 | 153 |
| 155 # Discards results that are after the end of regression. | 154 # Discards results that are after the end of regression. |
| 156 if not utils.IsGitHash(blame.revision) and ( | 155 if not utils.IsGitHash(blame.revision) and ( |
| 157 int(blame.revision) < int(blame.range_end)): | 156 int(blame.range_end) < int(blame.revision)): |
|
stgao
2014/08/15 19:42:38
I think it should be <= instead of <.
| |
| 158 continue | 157 continue |
| 159 | 158 |
| 160 filtered_blame_list.append(blame) | 159 filtered_blame_list.append(blame) |
| 161 | 160 |
| 162 self.blame_list = filtered_blame_list | 161 self.blame_list = filtered_blame_list |
| OLD | NEW |