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

Side by Side Diff: PRESUBMIT.py

Issue 11496010: PRESUBMIT #include check: don't add a warning if we're committing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | PRESUBMIT_test.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) 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 """ 612 """
613 613
614 warnings = [] 614 warnings = []
615 for f in input_api.AffectedFiles(): 615 for f in input_api.AffectedFiles():
616 if f.LocalPath().endswith(('.cc', '.h')): 616 if f.LocalPath().endswith(('.cc', '.h')):
617 changed_linenums = set(line_num for line_num, _ in f.ChangedContents()) 617 changed_linenums = set(line_num for line_num, _ in f.ChangedContents())
618 warnings.extend(_CheckIncludeOrderInFile(input_api, f, changed_linenums)) 618 warnings.extend(_CheckIncludeOrderInFile(input_api, f, changed_linenums))
619 619
620 results = [] 620 results = []
621 if warnings: 621 if warnings:
622 results.append(output_api.PresubmitPromptWarning(_INCLUDE_ORDER_WARNING, 622 if not input_api.is_committing:
623 warnings)) 623 results.append(output_api.PresubmitPromptWarning(_INCLUDE_ORDER_WARNING,
624 warnings))
625 else:
626 # We don't warn on commit, to avoid stopping commits going through CQ.
627 results.append(output_api.PresubmitNotifyResult(_INCLUDE_ORDER_WARNING,
628 warnings))
624 return results 629 return results
625 630
626 631
627 def _CheckForVersionControlConflictsInFile(input_api, f): 632 def _CheckForVersionControlConflictsInFile(input_api, f):
628 pattern = input_api.re.compile('^(?:<<<<<<<|>>>>>>>) |^=======$') 633 pattern = input_api.re.compile('^(?:<<<<<<<|>>>>>>>) |^=======$')
629 errors = [] 634 errors = []
630 for line_num, line in f.ChangedContents(): 635 for line_num, line in f.ChangedContents():
631 if pattern.match(line): 636 if pattern.match(line):
632 errors.append(' %s:%d %s' % (f.LocalPath(), line_num, line)) 637 errors.append(' %s:%d %s' % (f.LocalPath(), line_num, line))
633 return errors 638 return errors
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 'win_aura', 827 'win_aura',
823 'win_rel', 828 'win_rel',
824 ] 829 ]
825 830
826 # Match things like path/aura/file.cc and path/file_aura.cc. 831 # Match things like path/aura/file.cc and path/file_aura.cc.
827 # Same for chromeos. 832 # Same for chromeos.
828 if any(re.search('[/_](aura|chromeos)', f) for f in files): 833 if any(re.search('[/_](aura|chromeos)', f) for f in files):
829 trybots += ['linux_chromeos_clang:compile', 'linux_chromeos_asan'] 834 trybots += ['linux_chromeos_clang:compile', 'linux_chromeos_asan']
830 835
831 return trybots 836 return trybots
OLDNEW
« no previous file with comments | « no previous file | PRESUBMIT_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698