| 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 from collections import namedtuple | 7 from collections import namedtuple |
| 8 | 8 |
| 9 from common import chrome_dependency_fetcher | 9 from common import chrome_dependency_fetcher |
| 10 from crash import crash_util | 10 from crash import crash_util |
| 11 from crash.results import MatchResults | 11 from crash.results import MatchResults |
| 12 from crash.scorers.aggregated_scorer import AggregatedScorer | 12 from crash.scorers.aggregated_scorer import AggregatedScorer |
| 13 from crash.scorers.min_distance import MinDistance | 13 from crash.scorers.min_distance import MinDistance |
| 14 from crash.scorers.top_frame_index import TopFrameIndex | 14 from crash.scorers.top_frame_index import TopFrameIndex |
| 15 from crash.stacktrace import CallStack | 15 from crash.stacktrace import CallStack |
| 16 from crash.stacktrace import Stacktrace | 16 from crash.stacktrace import Stacktrace |
| 17 from lib.gitiles.diff import ChangeType | 17 from libs.gitiles.diff import ChangeType |
| 18 |
| 18 | 19 |
| 19 class ChangelistClassifier(namedtuple('ChangelistClassifier', | 20 class ChangelistClassifier(namedtuple('ChangelistClassifier', |
| 20 ['repository', 'top_n_frames', 'top_n_results', 'confidence_threshold'])): | 21 ['repository', 'top_n_frames', 'top_n_results', 'confidence_threshold'])): |
| 21 __slots__ = () | 22 __slots__ = () |
| 22 | 23 |
| 23 def __new__(cls, repository, | 24 def __new__(cls, repository, |
| 24 top_n_frames, top_n_results=3, confidence_threshold=0.999): | 25 top_n_frames, top_n_results=3, confidence_threshold=0.999): |
| 25 """Args: | 26 """Args: |
| 26 repository (Repository): the Git repository for getting CLs to classify. | 27 repository (Repository): the Git repository for getting CLs to classify. |
| 27 top_n_frames (int): how many frames of each callstack to look at. | 28 top_n_frames (int): how many frames of each callstack to look at. |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 repository.repo_url = stack_deps[dep].repo_url | 303 repository.repo_url = stack_deps[dep].repo_url |
| 303 blame = repository.GetBlame(touched_file_path, | 304 blame = repository.GetBlame(touched_file_path, |
| 304 stack_deps[dep].revision) | 305 stack_deps[dep].revision) |
| 305 | 306 |
| 306 # Generate/update each result(changelog) in changelogs, blame is used | 307 # Generate/update each result(changelog) in changelogs, blame is used |
| 307 # to calculate distance between touched lines and crashed lines in file. | 308 # to calculate distance between touched lines and crashed lines in file. |
| 308 match_results.GenerateMatchResults( | 309 match_results.GenerateMatchResults( |
| 309 touched_file_path, dep, stack_infos, changelogs, blame) | 310 touched_file_path, dep, stack_infos, changelogs, blame) |
| 310 | 311 |
| 311 return match_results.values() | 312 return match_results.values() |
| OLD | NEW |