Commit b742cce1 authored by Jeff Carpenter's avatar Jeff Carpenter Committed by Commit Bot

[WPT Export] When scanning commits, filter out those with PRs

Also:
- Print out `git apply` error message in LocalWPT.test_patch
- Add accidentally omitted return statement in WPTGitHub.pr_for_chromium_commit

Bug: 737898
Change-Id: Id35454a3a5a91dd4963c7e7f0f86d5a29fb79cfd
Reviewed-on: https://chromium-review.googlesource.com/571400Reviewed-by: default avatarQuinten Yearsley <qyearsley@chromium.org>
Commit-Queue: Jeff Carpenter <jeffcarp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486663}
parent ba98d2a3
......@@ -73,7 +73,7 @@ class ChromiumCommit(object):
def subject(self):
return self.host.executive.run_command([
'git', 'show', '--format=%s', '--no-patch', self.sha
], cwd=self.absolute_chromium_dir)
], cwd=self.absolute_chromium_dir).strip()
def body(self):
return self.host.executive.run_command([
......
......@@ -84,8 +84,9 @@ def is_exportable(chromium_commit, local_wpt, wpt_github):
message = chromium_commit.message()
if 'NOEXPORT=true' in message or 'No-Export: true' in message or message.startswith('Import'):
return False
patch = chromium_commit.format_patch()
if not (patch and local_wpt.test_patch(patch, chromium_commit)):
if not patch:
return False
# If there's a corresponding closed PR, then this commit should not
......@@ -94,6 +95,10 @@ def is_exportable(chromium_commit, local_wpt, wpt_github):
pull_request = wpt_github.pr_for_chromium_commit(chromium_commit)
if pull_request and pull_request.state == 'closed':
return False
if not local_wpt.test_patch(patch, chromium_commit):
return False
return True
......
......@@ -138,11 +138,12 @@ class LocalWPT(object):
self.run(['git', 'apply', '-'], input=patch)
self.run(['git', 'add', '.'])
output = self.run(['git', 'diff', 'origin/master'])
except ScriptError:
_log.debug('Patch did not apply cleanly for the following commit, skipping:')
except ScriptError as e:
_log.info('Patch did not apply cleanly for the following commit:')
if chromium_commit:
_log.debug('Commit: %s', chromium_commit.url())
_log.debug('Commit subject: "%s"', chromium_commit.subject())
_log.info('Commit: %s', chromium_commit.url())
_log.info('Commit subject: "%s"', chromium_commit.subject())
_log.info('Message: %s\n\n', e.message)
output = ''
self.clean()
......
......@@ -236,7 +236,7 @@ class WPTGitHub(object):
# so we fall back to trying to use commit position here, although
# commit position is not correct sometimes (https://crbug.com/737178).
# TODO(qyearsley): Remove this fallback after full Gerrit migration.
pull_request = self.pr_with_position(chromium_commit.position)
return self.pr_with_position(chromium_commit.position)
def pr_with_change_id(self, target_change_id):
for pull_request in self.all_pull_requests():
......
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