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

Side by Side Diff: appengine/findit/waterfall/build_failure_analysis.py

Issue 2524633002: [Culprit-Finder] Refactor GitilesRepostory to make http_client required argument. (Closed)
Patch Set: Rebase Created 4 years 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
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 collections import defaultdict 5 from collections import defaultdict
6 import os 6 import os
7 import re 7 import re
8 8
9 from common.http_client_appengine import HttpClientAppengine as HttpClient 9 from common.http_client_appengine import HttpClientAppengine as HttpClient
10 from lib.gitiles.diff import ChangeType 10 from lib.gitiles.diff import ChangeType
(...skipping 26 matching lines...) Expand all
37 37
38 def _GetGitBlame(repo_info, touched_file_path): 38 def _GetGitBlame(repo_info, touched_file_path):
39 """Gets git blames of touched_file. 39 """Gets git blames of touched_file.
40 40
41 Args: 41 Args:
42 repo_info (dict): The repo_url and revision for the build cycle. 42 repo_info (dict): The repo_url and revision for the build cycle.
43 touched_file_path (str): Full path of a file in change_log. 43 touched_file_path (str): Full path of a file in change_log.
44 """ 44 """
45 if repo_info: 45 if repo_info:
46 repo_url = repo_info['repo_url'] 46 repo_url = repo_info['repo_url']
47 git_repo = GitilesRepository(repo_url, HttpClient()) 47 git_repo = GitilesRepository(HttpClient(), repo_url)
48 revision = repo_info['revision'] 48 revision = repo_info['revision']
49 return git_repo.GetBlame(touched_file_path, revision) 49 return git_repo.GetBlame(touched_file_path, revision)
50 50
51 51
52 def _GetChangedLinesForChromiumRepo(repo_info, touched_file, line_numbers, 52 def _GetChangedLinesForChromiumRepo(repo_info, touched_file, line_numbers,
53 suspected_revision): 53 suspected_revision):
54 """Checks if the CL made change close to the failed line in log. 54 """Checks if the CL made change close to the failed line in log.
55 55
56 Args: 56 Args:
57 repo_info (dict): The repo_url and revision for the build cycle. 57 repo_info (dict): The repo_url and revision for the build cycle.
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 435
436 return None, None 436 return None, None
437 437
438 438
439 def _GetChangedLinesForDependencyRepo(roll, file_path_in_log, line_numbers): 439 def _GetChangedLinesForDependencyRepo(roll, file_path_in_log, line_numbers):
440 """Gets changed line numbers for file in failure log. 440 """Gets changed line numbers for file in failure log.
441 441
442 Tests if the same lines mentioned in failure log are changed within 442 Tests if the same lines mentioned in failure log are changed within
443 the DEPS roll, if so, return those line numbers. 443 the DEPS roll, if so, return those line numbers.
444 """ 444 """
445 roll_repo = GitilesRepository(roll['repo_url'], HttpClient()) 445 roll_repo = GitilesRepository(HttpClient(), roll['repo_url'])
446 old_revision = roll['old_revision'] 446 old_revision = roll['old_revision']
447 new_revision = roll['new_revision'] 447 new_revision = roll['new_revision']
448 old_change_log = roll_repo.GetChangeLog(old_revision) 448 old_change_log = roll_repo.GetChangeLog(old_revision)
449 old_rev_author_time = old_change_log.author_time 449 old_rev_author_time = old_change_log.author_time
450 new_change_log = roll_repo.GetChangeLog(new_revision) 450 new_change_log = roll_repo.GetChangeLog(new_revision)
451 new_rev_author_time = new_change_log.author_time 451 new_rev_author_time = new_change_log.author_time
452 452
453 file_change_type = None 453 file_change_type = None
454 changed_line_numbers = [] 454 changed_line_numbers = []
455 455
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 _SaveFailureToMap( 799 _SaveFailureToMap(
800 cl_failure_map, new_suspected_cl_dict, step_name, None, 800 cl_failure_map, new_suspected_cl_dict, step_name, None,
801 max(justification_dict['hints'].values())) 801 max(justification_dict['hints'].values()))
802 802
803 # TODO(stgao): sort CLs by score. 803 # TODO(stgao): sort CLs by score.
804 analysis_result['failures'].append(step_analysis_result) 804 analysis_result['failures'].append(step_analysis_result)
805 805
806 suspected_cls = _ConvertCLFailureMapToList(cl_failure_map) 806 suspected_cls = _ConvertCLFailureMapToList(cl_failure_map)
807 807
808 return analysis_result, suspected_cls 808 return analysis_result, suspected_cls
OLDNEW
« no previous file with comments | « appengine/findit/lib/gitiles/test/gitiles_repository_test.py ('k') | appengine/findit/waterfall/extract_deps_info_pipeline.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698