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

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

Issue 2344443005: [Findit] Factoring the gitiles (etc) stuff out into its own directory (Closed)
Patch Set: reordering imports 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
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.diff import ChangeType
10 from common.git_repository import GitRepository
11 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
11 from lib.gitiles.gitiles_repository import GitilesRepository
12 from waterfall.failure_signal import FailureSignal
12 from waterfall import waterfall_config 13 from waterfall import waterfall_config
13 from waterfall.failure_signal import FailureSignal
14 14
15 15
16 def _IsSameFile(changed_src_file_path, file_path_in_log): 16 def _IsSameFile(changed_src_file_path, file_path_in_log):
17 """Guesses if the two files are the same. 17 """Guesses if the two files are the same.
18 18
19 Args: 19 Args:
20 changed_src_file_path (str): Full path of a file committed to git repo. 20 changed_src_file_path (str): Full path of a file committed to git repo.
21 file_path_in_log (str): Path of a file appearing in a failure log. It might 21 file_path_in_log (str): Path of a file appearing in a failure log. It might
22 not be a full path. 22 not be a full path.
23 23
(...skipping 13 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 = GitRepository(repo_url, HttpClient()) 47 git_repo = GitilesRepository(repo_url, HttpClient())
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 = GitRepository(roll['repo_url'], HttpClient()) 445 roll_repo = GitilesRepository(roll['repo_url'], HttpClient())
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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 if not is_test_level: 798 if not is_test_level:
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/test/cache_decorator_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