| 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 crash import crash_util | 9 from crash import crash_util |
| 10 from crash.results import MatchResults | 10 from crash.results import MatchResults |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 repository (Repository): Repository to get changelogs and blame from. | 285 repository (Repository): Repository to get changelogs and blame from. |
| 286 ignore_cls (set): Set of reverted revisions. | 286 ignore_cls (set): Set of reverted revisions. |
| 287 | 287 |
| 288 Returns: | 288 Returns: |
| 289 A list of MatchResult instances with confidence and reason unset. | 289 A list of MatchResult instances with confidence and reason unset. |
| 290 """ | 290 """ |
| 291 match_results = MatchResults(ignore_cls) | 291 match_results = MatchResults(ignore_cls) |
| 292 | 292 |
| 293 for dep, file_to_stack_infos in dep_to_file_to_stack_infos.iteritems(): | 293 for dep, file_to_stack_infos in dep_to_file_to_stack_infos.iteritems(): |
| 294 file_to_changelogs = dep_to_file_to_changelogs[dep] | 294 file_to_changelogs = dep_to_file_to_changelogs[dep] |
| 295 repository.repo_url = stack_deps[dep].repo_url | |
| 296 | 295 |
| 297 for crashed_file_path, stack_infos in file_to_stack_infos.iteritems(): | 296 for crashed_file_path, stack_infos in file_to_stack_infos.iteritems(): |
| 298 for touched_file_path, changelogs in file_to_changelogs.iteritems(): | 297 for touched_file_path, changelogs in file_to_changelogs.iteritems(): |
| 299 if not crash_util.IsSameFilePath(crashed_file_path, touched_file_path): | 298 if not crash_util.IsSameFilePath(crashed_file_path, touched_file_path): |
| 300 continue | 299 continue |
| 301 | 300 |
| 301 repository.repo_url = stack_deps[dep].repo_url |
| 302 blame = repository.GetBlame(touched_file_path, | 302 blame = repository.GetBlame(touched_file_path, |
| 303 stack_deps[dep].revision) | 303 stack_deps[dep].revision) |
| 304 | 304 |
| 305 # Generate/update each result(changelog) in changelogs, blame is used | 305 # Generate/update each result(changelog) in changelogs, blame is used |
| 306 # to calculate distance between touched lines and crashed lines in file. | 306 # to calculate distance between touched lines and crashed lines in file. |
| 307 match_results.GenerateMatchResults( | 307 match_results.GenerateMatchResults( |
| 308 touched_file_path, dep, stack_infos, changelogs, blame) | 308 touched_file_path, dep, stack_infos, changelogs, blame) |
| 309 | 309 |
| 310 return match_results.values() | 310 return match_results.values() |
| OLD | NEW |