Commit 34d106c9 authored by Philip Jägenstedt's avatar Philip Jägenstedt Committed by Commit Bot

[WPT Export] Allow commits with "Import" in subject to be exported

These conditions are no longer needed, as real import commits have
'No-Export: true' in their commit message.

Bug: 879128
Change-Id: I829373c595931d8b221066b4edbb55bcb4db8cb7
Reviewed-on: https://chromium-review.googlesource.com/1196447Reviewed-by: default avatarRobert Ma <robertma@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587571}
parent a74c3983
...@@ -100,7 +100,7 @@ def get_commit_export_state(chromium_commit, local_wpt, wpt_github, verify_merge ...@@ -100,7 +100,7 @@ def get_commit_export_state(chromium_commit, local_wpt, wpt_github, verify_merge
apply (i.e. state=CommitExportState.EXPORTABLE_DIRTY). apply (i.e. state=CommitExportState.EXPORTABLE_DIRTY).
""" """
message = chromium_commit.message() message = chromium_commit.message()
if 'NOEXPORT=true' in message or 'No-Export: true' in message or message.startswith('Import'): if 'NOEXPORT=true' in message or 'No-Export: true' in message:
return CommitExportState.IGNORED, '' return CommitExportState.IGNORED, ''
patch = chromium_commit.format_patch() patch = chromium_commit.format_patch()
......
...@@ -115,10 +115,13 @@ class ChromiumExportableCommitsTest(unittest.TestCase): ...@@ -115,10 +115,13 @@ class ChromiumExportableCommitsTest(unittest.TestCase):
old_revert = MockChromiumCommit(MockHost(), body='Revert of Message\n> NOEXPORT=true') old_revert = MockChromiumCommit(MockHost(), body='Revert of Message\n> NOEXPORT=true')
self.assertEqual(get_commit_export_state(old_revert, MockLocalWPT(), github), (CommitExportState.IGNORED, '')) self.assertEqual(get_commit_export_state(old_revert, MockLocalWPT(), github), (CommitExportState.IGNORED, ''))
def test_commit_that_starts_with_import_is_not_exportable(self): # "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):
commit = MockChromiumCommit(MockHost(), subject='Import message') commit = MockChromiumCommit(MockHost(), subject='Import message')
github = MockWPTGitHub(pull_requests=[]) github = MockWPTGitHub(pull_requests=[])
self.assertEqual(get_commit_export_state(commit, MockLocalWPT(), github), (CommitExportState.IGNORED, '')) self.assertEqual(get_commit_export_state(commit, MockLocalWPT(test_patch=[(True, '')]), github),
(CommitExportState.EXPORTABLE_CLEAN, ''))
def test_commit_that_has_open_pr_is_exportable(self): def test_commit_that_has_open_pr_is_exportable(self):
commit = MockChromiumCommit(MockHost(), change_id='I00decade') commit = MockChromiumCommit(MockHost(), change_id='I00decade')
......
...@@ -130,12 +130,6 @@ class GerritCL(object): ...@@ -130,12 +130,6 @@ class GerritCL(object):
_log.info('Rejecting CL with over 1000 files: %s (ID: %s) ', self.subject, self.change_id) _log.info('Rejecting CL with over 1000 files: %s (ID: %s) ', self.subject, self.change_id)
return False return False
if self.subject.startswith('Import wpt@'):
return False
if 'Import' in self.subject:
return False
if 'No-Export: true' in self.current_revision['commit_with_footers']: if 'No-Export: true' in self.current_revision['commit_with_footers']:
return False return False
......
...@@ -60,3 +60,88 @@ class GerritCLTest(unittest.TestCase): ...@@ -60,3 +60,88 @@ class GerritCLTest(unittest.TestCase):
gerrit_cl = GerritCL(data, MockGerritAPI()) gerrit_cl = GerritCL(data, MockGerritAPI())
# It's important that this does not throw! # It's important that this does not throw!
self.assertFalse(gerrit_cl.is_exportable()) self.assertFalse(gerrit_cl.is_exportable())
def test_wpt_cl_is_exportable(self):
data = {
'change_id': 'Ib58c7125d85d2fd71af711ea8bbd2dc927ed02cb',
'subject': 'fake subject',
'_number': 638250,
'current_revision': '1',
'revisions': {'1': {
'commit_with_footers': 'fake subject',
'files': {
'third_party/WebKit/LayoutTests/external/wpt/foo/bar.html': '',
}
}},
'owner': {'email': 'test@chromium.org'},
}
gerrit_cl = GerritCL(data, MockGerritAPI())
self.assertTrue(gerrit_cl.is_exportable())
def test_no_wpt_cl_is_not_exportable(self):
data = {
'change_id': 'Ib58c7125d85d2fd71af711ea8bbd2dc927ed02cb',
'subject': 'fake subject',
'_number': 638250,
'current_revision': '1',
'revisions': {'1': {
'commit_with_footers': 'fake subject',
'files': {
'third_party/WebKit/LayoutTests/foo/bar.html': '',
}
}},
'owner': {'email': 'test@chromium.org'},
}
gerrit_cl = GerritCL(data, MockGerritAPI())
self.assertFalse(gerrit_cl.is_exportable())
def test_no_export_is_not_exportable(self):
data = {
'change_id': 'Ib58c7125d85d2fd71af711ea8bbd2dc927ed02cb',
'subject': 'fake subject',
'_number': 638250,
'current_revision': '1',
'revisions': {'1': {
'commit_with_footers': 'fake subject\nNo-Export: true',
'files': {
'third_party/WebKit/LayoutTests/external/wpt/foo/bar.html': '',
}
}},
'owner': {'email': 'test@chromium.org'},
}
gerrit_cl = GerritCL(data, MockGerritAPI())
self.assertFalse(gerrit_cl.is_exportable())
def test_legacy_noexport_is_not_exportable(self):
data = {
'change_id': 'Ib58c7125d85d2fd71af711ea8bbd2dc927ed02cb',
'subject': 'fake subject',
'_number': 638250,
'current_revision': '1',
'revisions': {'1': {
'commit_with_footers': 'fake subject\nNOEXPORT=true',
'files': {
'third_party/WebKit/LayoutTests/external/wpt/foo/bar.html': '',
}
}},
'owner': {'email': 'test@chromium.org'},
}
gerrit_cl = GerritCL(data, MockGerritAPI())
self.assertFalse(gerrit_cl.is_exportable())
def test_import_in_subject_is_exportable(self):
data = {
'change_id': 'Ib58c7125d85d2fd71af711ea8bbd2dc927ed02cb',
'subject': 'Import something',
'_number': 638250,
'current_revision': '1',
'revisions': {'1': {
'commit_with_footers': 'fake subject',
'files': {
'third_party/WebKit/LayoutTests/external/wpt/foo/bar.html': '',
}
}},
'owner': {'email': 'test@chromium.org'},
}
gerrit_cl = GerritCL(data, MockGerritAPI())
self.assertTrue(gerrit_cl.is_exportable())
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