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

Side by Side Diff: appengine/findit/crash/changelist_classifier.py

Issue 2449853012: [Predator] Fix bug in min_distance after refactor and add back skip added/deleted deps. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 | appengine/findit/crash/culprit.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 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 frame_list=stack[:self.top_n_frames]) 64 frame_list=stack[:self.top_n_frames])
65 for stack in report.stacktrace]) 65 for stack in report.stacktrace])
66 66
67 # We are only interested in the deps in crash stack (the callstack that 67 # We are only interested in the deps in crash stack (the callstack that
68 # caused the crash). 68 # caused the crash).
69 # TODO(wrengr): we may want to receive the crash deps as an argument, 69 # TODO(wrengr): we may want to receive the crash deps as an argument,
70 # so that when this method is called via Findit.FindCulprit, we avoid 70 # so that when this method is called via Findit.FindCulprit, we avoid
71 # doing redundant work creating it. 71 # doing redundant work creating it.
72 stack_deps = GetDepsInCrashStack( 72 stack_deps = GetDepsInCrashStack(
73 report.stacktrace.crash_stack, 73 report.stacktrace.crash_stack,
74 chrome_dependency_fetcher.ChromeDependencyFetcher(self._repository 74 chrome_dependency_fetcher.ChromeDependencyFetcher(
75 ).GetDependency(report.crashed_version, report.platform)) 75 self._repository).GetDependency(report.crashed_version,
76 report.platform))
76 77
77 # Get dep and file to changelogs, stack_info and blame dicts. 78 # Get dep and file to changelogs, stack_info and blame dicts.
78 regression_deps_rolls = chrome_dependency_fetcher.ChromeDependencyFetcher( 79 dep_rolls = chrome_dependency_fetcher.ChromeDependencyFetcher(
79 self._repository).GetDependencyRollsDict( 80 self._repository).GetDependencyRollsDict(
80 last_good_version, first_bad_version, report.platform) 81 last_good_version, first_bad_version, report.platform)
82
83 # Regression of a dep added/deleted (old_revision/new_revision is None) can
84 # not be known for sure and this case rarely happens, so just filter them
85 # out.
86 regression_deps_rolls = {}
87 for dep_path, dep_roll in dep_rolls.iteritems():
88 if not dep_roll.old_revision or not dep_roll.new_revision:
89 logging.info('Skip %s denpendency %s',
90 'added' if dep_roll.new_revision else 'deleted', dep_path)
91 continue
92 regression_deps_rolls[dep_path] = dep_roll
93
81 dep_to_file_to_changelogs, ignore_cls = GetChangeLogsForFilesGroupedByDeps( 94 dep_to_file_to_changelogs, ignore_cls = GetChangeLogsForFilesGroupedByDeps(
82 regression_deps_rolls, stack_deps, self._repository) 95 regression_deps_rolls, stack_deps, self._repository)
83 dep_to_file_to_stack_infos = GetStackInfosForFilesGroupedByDeps( 96 dep_to_file_to_stack_infos = GetStackInfosForFilesGroupedByDeps(
84 stacktrace, stack_deps) 97 stacktrace, stack_deps)
85 98
86 # TODO: argument order is inconsistent from others. Repository should 99 # TODO: argument order is inconsistent from others. Repository should
87 # be last argument. 100 # be last argument.
88 results = FindMatchResults(dep_to_file_to_changelogs, 101 results = FindMatchResults(dep_to_file_to_changelogs,
89 dep_to_file_to_stack_infos, 102 dep_to_file_to_stack_infos,
90 stack_deps, self._repository, ignore_cls) 103 stack_deps, self._repository, ignore_cls)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 dep_roll = regression_deps_rolls.get(dep) 197 dep_roll = regression_deps_rolls.get(dep)
185 if not dep_roll: 198 if not dep_roll:
186 continue 199 continue
187 200
188 dep_roll = regression_deps_rolls[dep] 201 dep_roll = regression_deps_rolls[dep]
189 202
190 repository.repo_url = dep_roll.repo_url 203 repository.repo_url = dep_roll.repo_url
191 changelogs = repository.GetChangeLogs(dep_roll.old_revision, 204 changelogs = repository.GetChangeLogs(dep_roll.old_revision,
192 dep_roll.new_revision) 205 dep_roll.new_revision)
193 206
207 if not changelogs:
208 continue
209
194 for changelog in changelogs: 210 for changelog in changelogs:
195 # When someone reverts, we need to skip both the CL doing 211 # When someone reverts, we need to skip both the CL doing
196 # the reverting as well as the CL that got reverted. If 212 # the reverting as well as the CL that got reverted. If
197 # ``reverted_revision`` is true, then this CL reverts another one, 213 # ``reverted_revision`` is true, then this CL reverts another one,
198 # so we skip it and save the CL it reverts in ``reverted_cls`` to 214 # so we skip it and save the CL it reverts in ``reverted_cls`` to
199 # be filtered out later. 215 # be filtered out later.
200 if changelog.reverted_revision: 216 if changelog.reverted_revision:
201 reverted_cls.add(changelog.reverted_revision) 217 reverted_cls.add(changelog.reverted_revision)
202 continue 218 continue
203 219
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 301
286 blame = repository.GetBlame(touched_file_path, 302 blame = repository.GetBlame(touched_file_path,
287 stack_deps[dep].revision) 303 stack_deps[dep].revision)
288 304
289 # Generate/update each result(changelog) in changelogs, blame is used 305 # Generate/update each result(changelog) in changelogs, blame is used
290 # to calculate distance between touched lines and crashed lines in file. 306 # to calculate distance between touched lines and crashed lines in file.
291 match_results.GenerateMatchResults( 307 match_results.GenerateMatchResults(
292 touched_file_path, dep, stack_infos, changelogs, blame) 308 touched_file_path, dep, stack_infos, changelogs, blame)
293 309
294 return match_results.values() 310 return match_results.values()
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/crash/culprit.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698