summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordbeam <dbeam@chromium.org>2015-06-01 18:40:23 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-02 01:40:56 +0000
commit95c35a2fad1b1c077ac233d338ea7e5e94c5315b (patch)
treeab3fcd94625b00d2b284ca35d0535dba95359fc9
parentdbd2ef9bb16d7fb63f44a992248b4dbed7f3f8e3 (diff)
downloadchromium_src-95c35a2fad1b1c077ac233d338ea7e5e94c5315b.zip
chromium_src-95c35a2fad1b1c077ac233d338ea7e5e94c5315b.tar.gz
chromium_src-95c35a2fad1b1c077ac233d338ea7e5e94c5315b.tar.bz2
Exclude .md files from version control conflict detection.
Turns out top-level headers basically look exactly like a merge conflict marker. R=jlklein@chromium.org BUG=495338 Review URL: https://codereview.chromium.org/1153013005 Cr-Commit-Position: refs/heads/master@{#332313}
-rw-r--r--PRESUBMIT.py4
-rwxr-xr-xPRESUBMIT_test.py10
2 files changed, 14 insertions, 0 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 751ae52..2e33261 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -841,6 +841,10 @@ def _CheckForVersionControlConflictsInFile(input_api, f):
pattern = input_api.re.compile('^(?:<<<<<<<|>>>>>>>) |^=======$')
errors = []
for line_num, line in f.ChangedContents():
+ if f.LocalPath().endswith('.md'):
+ # First-level headers in markdown look a lot like version control
+ # conflict markers. http://daringfireball.net/projects/markdown/basics
+ continue
if pattern.match(line):
errors.append(' %s:%d %s' % (f.LocalPath(), line_num, line))
return errors
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
index 18e3c6e..195fe4f 100755
--- a/PRESUBMIT_test.py
+++ b/PRESUBMIT_test.py
@@ -270,6 +270,16 @@ class VersionControlConflictsTest(unittest.TestCase):
self.assertTrue('3' in errors[1])
self.assertTrue('5' in errors[2])
+ def testIgnoresReadmes(self):
+ lines = ['A First Level Header',
+ '====================',
+ '',
+ 'A Second Level Header',
+ '---------------------']
+ errors = PRESUBMIT._CheckForVersionControlConflictsInFile(
+ MockInputApi(), MockFile('some/polymer/README.md', lines))
+ self.assertEqual(0, len(errors))
+
class UmaHistogramChangeMatchedOrNotTest(unittest.TestCase):
def testTypicalCorrectlyMatchedChange(self):
diff_cc = ['UMA_HISTOGRAM_BOOL("Bla.Foo.Dummy", true)']