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 import logging | 5 import logging |
6 from collections import defaultdict | 6 from collections import defaultdict |
7 | 7 |
8 from common import chrome_dependency_fetcher | 8 from common import chrome_dependency_fetcher |
9 from common.diff import ChangeType | |
10 from common.git_repository import GitRepository | |
11 from common.http_client_appengine import HttpClientAppengine | 9 from common.http_client_appengine import HttpClientAppengine |
12 from crash import crash_util | 10 from crash import crash_util |
13 from crash.results import MatchResults | 11 from crash.results import MatchResults |
14 from crash.scorers.aggregated_scorer import AggregatedScorer | 12 from crash.scorers.aggregated_scorer import AggregatedScorer |
15 from crash.scorers.min_distance import MinDistance | 13 from crash.scorers.min_distance import MinDistance |
16 from crash.scorers.top_frame_index import TopFrameIndex | 14 from crash.scorers.top_frame_index import TopFrameIndex |
17 from crash.stacktrace import CallStack | 15 from crash.stacktrace import CallStack |
18 from crash.stacktrace import Stacktrace | 16 from crash.stacktrace import Stacktrace |
| 17 from lib.gitiles.diff import ChangeType |
19 | 18 |
20 # TODO(wrengr): make this a namedtuple. | 19 # TODO(wrengr): make this a namedtuple. |
21 class ChangelistClassifier(object): | 20 class ChangelistClassifier(object): |
22 def __init__(self, repository, | 21 def __init__(self, repository, |
23 top_n_frames, top_n_results=3, confidence_threshold=0.999): | 22 top_n_frames, top_n_results=3, confidence_threshold=0.999): |
24 """Args: | 23 """Args: |
25 repository (Repository): the Git repository for getting CLs to classify. | 24 repository (Repository): the Git repository for getting CLs to classify. |
26 top_n_frames (int): how many frames of each callstack to look at. | 25 top_n_frames (int): how many frames of each callstack to look at. |
27 top_n_results (int): maximum number of results to return. | 26 top_n_results (int): maximum number of results to return. |
28 confidence_threshold (float): In [0,1], above which we only return | 27 confidence_threshold (float): In [0,1], above which we only return |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 286 |
288 blame = repository.GetBlame(crashed_file_path, | 287 blame = repository.GetBlame(crashed_file_path, |
289 stack_deps[dep].revision) | 288 stack_deps[dep].revision) |
290 | 289 |
291 # Generate/update each result(changelog) in changelogs, blame is used | 290 # Generate/update each result(changelog) in changelogs, blame is used |
292 # to calculate distance between touched lines and crashed lines in file. | 291 # to calculate distance between touched lines and crashed lines in file. |
293 match_results.GenerateMatchResults( | 292 match_results.GenerateMatchResults( |
294 crashed_file_path, dep, stack_infos, changelogs, blame) | 293 crashed_file_path, dep, stack_infos, changelogs, blame) |
295 | 294 |
296 return match_results.values() | 295 return match_results.values() |
OLD | NEW |