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

Side by Side Diff: PRESUBMIT.py

Issue 1153013005: Exclude .md files from version control conflict detection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bettar Created 5 years, 6 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 | « 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 depot_tools. 8 for more details about the presubmit API built into depot_tools.
9 """ 9 """
10 10
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 if warnings: 834 if warnings:
835 results.append(output_api.PresubmitPromptOrNotify(_INCLUDE_ORDER_WARNING, 835 results.append(output_api.PresubmitPromptOrNotify(_INCLUDE_ORDER_WARNING,
836 warnings)) 836 warnings))
837 return results 837 return results
838 838
839 839
840 def _CheckForVersionControlConflictsInFile(input_api, f): 840 def _CheckForVersionControlConflictsInFile(input_api, f):
841 pattern = input_api.re.compile('^(?:<<<<<<<|>>>>>>>) |^=======$') 841 pattern = input_api.re.compile('^(?:<<<<<<<|>>>>>>>) |^=======$')
842 errors = [] 842 errors = []
843 for line_num, line in f.ChangedContents(): 843 for line_num, line in f.ChangedContents():
844 if f.LocalPath().endswith('.md'):
845 # First-level headers in markdown look a lot like version control
846 # conflict markers. http://daringfireball.net/projects/markdown/basics
847 continue
844 if pattern.match(line): 848 if pattern.match(line):
845 errors.append(' %s:%d %s' % (f.LocalPath(), line_num, line)) 849 errors.append(' %s:%d %s' % (f.LocalPath(), line_num, line))
846 return errors 850 return errors
847 851
848 852
849 def _CheckForVersionControlConflicts(input_api, output_api): 853 def _CheckForVersionControlConflicts(input_api, output_api):
850 """Usually this is not intentional and will cause a compile failure.""" 854 """Usually this is not intentional and will cause a compile failure."""
851 errors = [] 855 errors = []
852 for f in input_api.AffectedFiles(): 856 for f in input_api.AffectedFiles():
853 errors.extend(_CheckForVersionControlConflictsInFile(input_api, f)) 857 errors.extend(_CheckForVersionControlConflictsInFile(input_api, f))
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
1803 # Explicitly iterate over copies of dicts since we mutate them. 1807 # Explicitly iterate over copies of dicts since we mutate them.
1804 for master in builders.keys(): 1808 for master in builders.keys():
1805 for builder in builders[master].keys(): 1809 for builder in builders[master].keys():
1806 # Do not trigger presubmit builders, since they're likely to fail 1810 # Do not trigger presubmit builders, since they're likely to fail
1807 # (e.g. OWNERS checks before finished code review), and we're 1811 # (e.g. OWNERS checks before finished code review), and we're
1808 # running local presubmit anyway. 1812 # running local presubmit anyway.
1809 if 'presubmit' in builder: 1813 if 'presubmit' in builder:
1810 builders[master].pop(builder) 1814 builders[master].pop(builder)
1811 1815
1812 return builders 1816 return builders
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