| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Top-level presubmit script for Chromium. | 5 """Top-level presubmit script for Chromium. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 for more details about the presubmit API built into gcl. | 8 for more details about the presubmit API built into gcl. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 warnings.extend(_CheckIncludeOrderInFile(input_api, f, False, | 628 warnings.extend(_CheckIncludeOrderInFile(input_api, f, False, |
| 629 changed_linenums)) | 629 changed_linenums)) |
| 630 | 630 |
| 631 results = [] | 631 results = [] |
| 632 if warnings: | 632 if warnings: |
| 633 results.append(output_api.PresubmitPromptWarning(_INCLUDE_ORDER_WARNING, | 633 results.append(output_api.PresubmitPromptWarning(_INCLUDE_ORDER_WARNING, |
| 634 warnings)) | 634 warnings)) |
| 635 return results | 635 return results |
| 636 | 636 |
| 637 | 637 |
| 638 def _CheckForVersionControlConflictsInFile(input_api, f): |
| 639 pattern = input_api.re.compile('^(?:<<<<<<<|>>>>>>>) |^=======$') |
| 640 errors = [] |
| 641 for line_num, line in f.ChangedContents(): |
| 642 if pattern.match(line): |
| 643 errors.append(' %s:%d %s' % (f.LocalPath(), line_num, line)) |
| 644 return errors |
| 645 |
| 646 |
| 647 def _CheckForVersionControlConflicts(input_api, output_api): |
| 648 """Usually this is not intentional and will cause a compile failure.""" |
| 649 errors = [] |
| 650 for f in input_api.AffectedFiles(): |
| 651 errors.extend(_CheckForVersionControlConflictsInFile(input_api, f)) |
| 652 |
| 653 results = [] |
| 654 if errors: |
| 655 results.append(output_api.PresubmitError( |
| 656 'Version control conflict markers found, please resolve.', errors)) |
| 657 return results |
| 658 |
| 659 |
| 638 def _CommonChecks(input_api, output_api): | 660 def _CommonChecks(input_api, output_api): |
| 639 """Checks common to both upload and commit.""" | 661 """Checks common to both upload and commit.""" |
| 640 results = [] | 662 results = [] |
| 641 results.extend(input_api.canned_checks.PanProjectChecks( | 663 results.extend(input_api.canned_checks.PanProjectChecks( |
| 642 input_api, output_api, excluded_paths=_EXCLUDED_PATHS)) | 664 input_api, output_api, excluded_paths=_EXCLUDED_PATHS)) |
| 643 results.extend(_CheckAuthorizedAuthor(input_api, output_api)) | 665 results.extend(_CheckAuthorizedAuthor(input_api, output_api)) |
| 644 results.extend( | 666 results.extend( |
| 645 _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api)) | 667 _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api)) |
| 646 results.extend(_CheckNoIOStreamInHeaders(input_api, output_api)) | 668 results.extend(_CheckNoIOStreamInHeaders(input_api, output_api)) |
| 647 results.extend(_CheckNoUNIT_TESTInSourceFiles(input_api, output_api)) | 669 results.extend(_CheckNoUNIT_TESTInSourceFiles(input_api, output_api)) |
| 648 results.extend(_CheckNoNewWStrings(input_api, output_api)) | 670 results.extend(_CheckNoNewWStrings(input_api, output_api)) |
| 649 results.extend(_CheckNoDEPSGIT(input_api, output_api)) | 671 results.extend(_CheckNoDEPSGIT(input_api, output_api)) |
| 650 results.extend(_CheckNoBannedFunctions(input_api, output_api)) | 672 results.extend(_CheckNoBannedFunctions(input_api, output_api)) |
| 651 results.extend(_CheckNoPragmaOnce(input_api, output_api)) | 673 results.extend(_CheckNoPragmaOnce(input_api, output_api)) |
| 652 results.extend(_CheckNoTrinaryTrueFalse(input_api, output_api)) | 674 results.extend(_CheckNoTrinaryTrueFalse(input_api, output_api)) |
| 653 results.extend(_CheckUnwantedDependencies(input_api, output_api)) | 675 results.extend(_CheckUnwantedDependencies(input_api, output_api)) |
| 654 results.extend(_CheckFilePermissions(input_api, output_api)) | 676 results.extend(_CheckFilePermissions(input_api, output_api)) |
| 655 results.extend(_CheckNoAuraWindowPropertyHInHeaders(input_api, output_api)) | 677 results.extend(_CheckNoAuraWindowPropertyHInHeaders(input_api, output_api)) |
| 656 results.extend(_CheckIncludeOrder(input_api, output_api)) | 678 results.extend(_CheckIncludeOrder(input_api, output_api)) |
| 679 results.extend(_CheckForVersionControlConflicts(input_api, output_api)) |
| 657 | 680 |
| 658 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()): | 681 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()): |
| 659 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( | 682 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( |
| 660 input_api, output_api, | 683 input_api, output_api, |
| 661 input_api.PresubmitLocalPath(), | 684 input_api.PresubmitLocalPath(), |
| 662 whitelist=[r'.+_test\.py$'])) | 685 whitelist=[r'.+_test\.py$'])) |
| 663 return results | 686 return results |
| 664 | 687 |
| 665 | 688 |
| 666 def _CheckSubversionConfig(input_api, output_api): | 689 def _CheckSubversionConfig(input_api, output_api): |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 | 823 |
| 801 # Match things like path/aura/file.cc and path/file_aura.cc. | 824 # Match things like path/aura/file.cc and path/file_aura.cc. |
| 802 # Same for ash and chromeos. | 825 # Same for ash and chromeos. |
| 803 if any(re.search('[/_](ash|aura)', f) for f in files): | 826 if any(re.search('[/_](ash|aura)', f) for f in files): |
| 804 trybots += ['linux_chromeos_clang:compile', 'win_aura', | 827 trybots += ['linux_chromeos_clang:compile', 'win_aura', |
| 805 'linux_chromeos_asan'] | 828 'linux_chromeos_asan'] |
| 806 elif any(re.search('[/_]chromeos', f) for f in files): | 829 elif any(re.search('[/_]chromeos', f) for f in files): |
| 807 trybots += ['linux_chromeos_clang:compile', 'linux_chromeos_asan'] | 830 trybots += ['linux_chromeos_clang:compile', 'linux_chromeos_asan'] |
| 808 | 831 |
| 809 return trybots | 832 return trybots |
| OLD | NEW |