Commit c0174686 authored by Luke Zielinski's avatar Luke Zielinski Committed by Commit Bot

Make the "No-export" check a little less case sensitive.

This will avoid missing CLs where True is used instead of true
(eg: https://chromium-review.googlesource.com/c/chromium/src/+/1459922
which is currently breaking import/export).

Change-Id: I87cfd936545506fd536e382f908391237a6e6b77
Reviewed-on: https://chromium-review.googlesource.com/c/1492671
Commit-Queue: Luke Z <lpz@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Auto-Submit: Luke Z <lpz@chromium.org>
Reviewed-by: default avatarRobert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636174}
parent ba830b19
......@@ -103,8 +103,8 @@ def get_commit_export_state(chromium_commit, local_wpt, wpt_github, verify_merge
error is a string of error messages if an exportable patch fails to
apply (i.e. state=CommitExportState.EXPORTABLE_DIRTY).
"""
message = chromium_commit.message()
if 'NOEXPORT=true' in message or 'No-Export: true' in message:
msg_lowercase = chromium_commit.message().lower()
if 'noexport=true' in msg_lowercase or 'no-export: true' in msg_lowercase:
return CommitExportState.IGNORED, ''
patch = chromium_commit.format_patch()
......
......@@ -116,6 +116,22 @@ class ChromiumExportableCommitsTest(unittest.TestCase):
old_revert = MockChromiumCommit(MockHost(), body='Revert of Message\n> NOEXPORT=true')
self.assertEqual(get_commit_export_state(old_revert, MockLocalWPT(), github), (CommitExportState.IGNORED, ''))
def test_commit_with_noexport_is_not_exportable_mixed_casing(self):
# Patch is not tested if the commit is ignored based on the message, hence empty MockLocalWPT.
# Make sure that the casing of the "No export" message isn't considered.
commit = MockChromiumCommit(MockHost(), body='Message\nno-EXPORT: true')
github = MockWPTGitHub(pull_requests=[])
self.assertEqual(get_commit_export_state(commit, MockLocalWPT(), github), (CommitExportState.IGNORED, ''))
commit = MockChromiumCommit(MockHost(), body='Message\nnoexport=TRUE')
github = MockWPTGitHub(pull_requests=[])
self.assertEqual(get_commit_export_state(commit, MockLocalWPT(), github), (CommitExportState.IGNORED, ''))
commit = MockChromiumCommit(MockHost(), body='Message\nNO-exPORT: trUE')
github = MockWPTGitHub(pull_requests=[])
self.assertEqual(get_commit_export_state(commit, MockLocalWPT(), github), (CommitExportState.IGNORED, ''))
# "Import" in commit message doesn't by itself make a commit exportable,
# see https://crbug.com/879128.
def test_commit_that_starts_with_import_is_exportable(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment