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

Side by Side Diff: tools/findit/findit_for_crash.py

Issue 510163002: [Findit] Fix blame for GIT and uptake bug fix. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reupload Created 6 years, 3 months 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 | « tools/findit/crash_utils.py ('k') | tools/findit/stacktrace.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 (c) 2014 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2014 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 os 5 import os
6 from threading import Lock, Thread 6 from threading import Lock, Thread
7 7
8 import blame 8 import blame
9 from common import utils 9 from common import utils
10 import component_dictionary 10 import component_dictionary
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 file_string = 'File %s is changed in this cl ' 470 file_string = 'File %s is changed in this cl '
471 else: 471 else:
472 file_string = 'Files %s are changed in this cl ' 472 file_string = 'Files %s are changed in this cl '
473 473
474 # Create a list of file names, and prettify the list. 474 # Create a list of file names, and prettify the list.
475 file_names = [ 475 file_names = [
476 file_name for (_, _, file_name, _, _) in rest_of_the_files] 476 file_name for (_, _, file_name, _, _) in rest_of_the_files]
477 pretty_file_names = crash_utils.PrettifyList(file_names) 477 pretty_file_names = crash_utils.PrettifyList(file_names)
478 478
479 # Add the reason, break because we took care of the rest of the files. 479 # Add the reason, break because we took care of the rest of the files.
480 file_string += '(%s)' % crash_utils.PrettifyFrameInfo( 480 file_string += ('(and is part of stack %s)' %
481 stack_frame_indices, function_list) 481 crash_utils.PrettifyFrameInfo(stack_frame_indices, function_list))
482 reason.append(file_string % pretty_file_names) 482 reason.append(file_string % pretty_file_names)
483 break 483 break
484 484
485 # Set the reason as string. 485 # Set the reason as string.
486 match.reason = '\n'.join(reason) 486 match.reason = '\n'.join(reason)
487 487
488 488
489 def CombineMatches(matches): 489 def CombineMatches(matches):
490 """Combine possible duplicates in matches. 490 """Combine possible duplicates in matches.
491 491
(...skipping 23 matching lines...) Expand all
515 # Combine the reason if the current match is already in there. 515 # Combine the reason if the current match is already in there.
516 found_match.reason += match.reason 516 found_match.reason += match.reason
517 if match.min_distance < found_match.min_distance: 517 if match.min_distance < found_match.min_distance:
518 found_match.min_distance = match.min_distance 518 found_match.min_distance = match.min_distance
519 found_match.min_distance_info = match.min_distance_info 519 found_match.min_distance_info = match.min_distance_info
520 520
521 for stack_index, cl, match in combined_matches: 521 for stack_index, cl, match in combined_matches:
522 if match.min_distance_info: 522 if match.min_distance_info:
523 file_name, min_crashed_line, min_changed_line = match.min_distance_info 523 file_name, min_crashed_line, min_changed_line = match.min_distance_info
524 match.reason += \ 524 match.reason += \
525 ('Minimum distance from crashed line to changed line: %d. ' 525 ('\nMinimum distance from crash line to modified line: %d. '
526 '(File: %s, Crashed on: %d, Changed: %d).\n' % 526 '(file: %s, crashed on: %d, modified: %d).\n' %
527 (match.min_distance, file_name, min_crashed_line, min_changed_line)) 527 (match.min_distance, file_name, min_crashed_line, min_changed_line))
528 528
529 return combined_matches 529 return combined_matches
530 530
531 531
532 def FilterAndGenerateReasonForMatches(result): 532 def FilterAndGenerateReasonForMatches(result):
533 """A wrapper function. 533 """A wrapper function.
534 534
535 It generates reasons for the matches and returns string representation 535 It generates reasons for the matches and returns string representation
536 of filtered results. 536 of filtered results.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 return (return_message, filtered_result) 661 return (return_message, filtered_result)
662 662
663 # If no match is found, return the blame information for the input 663 # If no match is found, return the blame information for the input
664 # callstack. 664 # callstack.
665 result = GenerateAndFilterBlameList( 665 result = GenerateAndFilterBlameList(
666 callstack, component_to_crash_revision_dict, 666 callstack, component_to_crash_revision_dict,
667 component_to_regression_dict) 667 component_to_regression_dict)
668 668
669 if result: 669 if result:
670 return_message = ( 670 return_message = (
671 'No CL in the regression changes the crashed files. The result is ' 671 'No CL in the regression range changes the crashed files. '
672 'the blame information.') 672 'The result is the blame information.')
673 673
674 # When findit could not find any CL that changes file in stacktrace or if 674 # When findit could not find any CL that changes file in stacktrace or if
675 # if cannot get any blame information, return a message saying that no 675 # if cannot get any blame information, return a message saying that no
676 # results are available. 676 # results are available.
677 else: 677 else:
678 return_message = ('Findit could not find any suspected CLs.') 678 return_message = ('Findit could not find any suspected CLs.')
679 679
680 return (return_message, result) 680 return (return_message, result)
681 681
OLDNEW
« no previous file with comments | « tools/findit/crash_utils.py ('k') | tools/findit/stacktrace.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698