Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: tools/findit/blame.py

Issue 468653003: [Findit] Fixed a bug where blame information is not correctly filtered (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed coderevie Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/findit/crash_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)):
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
OLDNEW
« no previous file with comments | « no previous file | tools/findit/crash_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698