OLD | NEW |
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 | 6 from threading import Lock |
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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 if cl == cl_combined: | 488 if cl == cl_combined: |
489 found_match = match_combined | 489 found_match = match_combined |
490 break | 490 break |
491 | 491 |
492 # If current match is not already in, add it to the list of matches. | 492 # If current match is not already in, add it to the list of matches. |
493 if not found_match: | 493 if not found_match: |
494 combined_matches.append((stack_index, cl, match)) | 494 combined_matches.append((stack_index, cl, match)) |
495 continue | 495 continue |
496 | 496 |
497 # Combine the reason if the current match is already in there. | 497 # Combine the reason if the current match is already in there. |
498 found_match.reason += match.reason | 498 found_match.reason += '\n' + match.reason |
499 if match.min_distance < found_match.min_distance: | 499 if match.min_distance < found_match.min_distance: |
500 found_match.min_distance = match.min_distance | 500 found_match.min_distance = match.min_distance |
501 found_match.min_distance_info = match.min_distance_info | 501 found_match.min_distance_info = match.min_distance_info |
502 | 502 |
503 for stack_index, cl, match in combined_matches: | 503 for stack_index, cl, match in combined_matches: |
504 if match.min_distance_info: | 504 if match.min_distance_info: |
505 file_name, min_crashed_line, min_changed_line = match.min_distance_info | 505 file_name, min_crashed_line, min_changed_line = match.min_distance_info |
506 match.reason += \ | 506 match.reason = match.reason.strip() |
507 ('\nMinimum distance from crash line to modified line: %d. ' | 507 match.reason += ( |
508 '(file: %s, crashed on: %d, modified: %d).\n' % | 508 '\nMinimum distance from crash line to modified line: %d. ' |
509 (match.min_distance, file_name, min_crashed_line, min_changed_line)) | 509 '(file: %s, crashed on: %d, modified: %d).' % |
| 510 (match.min_distance, file_name, min_crashed_line, min_changed_line)) |
510 | 511 |
511 return combined_matches | 512 return combined_matches |
512 | 513 |
513 | 514 |
514 def FilterAndGenerateReasonForMatches(result): | 515 def FilterAndGenerateReasonForMatches(result): |
515 """A wrapper function. | 516 """A wrapper function. |
516 | 517 |
517 It generates reasons for the matches and returns string representation | 518 It generates reasons for the matches and returns string representation |
518 of filtered results. | 519 of filtered results. |
519 | 520 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 'The result is the blame information.') | 655 'The result is the blame information.') |
655 | 656 |
656 # When findit could not find any CL that changes file in stacktrace or if | 657 # When findit could not find any CL that changes file in stacktrace or if |
657 # if cannot get any blame information, return a message saying that no | 658 # if cannot get any blame information, return a message saying that no |
658 # results are available. | 659 # results are available. |
659 else: | 660 else: |
660 return_message = ('Findit could not find any suspected CLs.') | 661 return_message = ('Findit could not find any suspected CLs.') |
661 | 662 |
662 return (return_message, result) | 663 return (return_message, result) |
663 | 664 |
OLD | NEW |