Skip to content

Commit

Permalink
[WPT Export] Include commit details when skipping commit
Browse files Browse the repository at this point in the history
Also reduce verbosity by automatically skipping import commits

BUG=
R=qyearsley@chromium.org

Review-Url: https://codereview.chromium.org/2664583002
Cr-Commit-Position: refs/heads/master@{#446861}
  • Loading branch information
jeffcarp authored and Commit bot committed Jan 28, 2017
1 parent 647709a commit 4bb102b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
8 changes: 4 additions & 4 deletions third_party/WebKit/Tools/Scripts/webkitpy/w3c/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def exportable_commits_since(chromium_commit_hash, host, local_wpt):
def is_exportable(chromium_commit, local_wpt):
"""Checks whether a given patch is exportable and can be applied."""
patch = chromium_commit.format_patch()
return (patch and
local_wpt.test_patch(patch) and
'NOEXPORT=true' not in chromium_commit.message() and
not chromium_commit.message().startswith('Import '))
return ('NOEXPORT=true' not in chromium_commit.message() and
not chromium_commit.message().startswith('Import ') and
patch and
local_wpt.test_patch(patch, chromium_commit))
15 changes: 10 additions & 5 deletions third_party/WebKit/Tools/Scripts/webkitpy/w3c/common_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def run_fn(args):

class MockLocalWPT(object):

def test_patch(self, _):
return True
def test_patch(self, patch, chromium_commit): # pylint: disable=unused-argument
return 'patch'


class CommonTest(unittest.TestCase):
Expand Down Expand Up @@ -68,7 +68,8 @@ def test_ignores_commits_with_noexport_true(self):
['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--',
'badbeef8/third_party/WebKit/LayoutTests/external/wpt/'],
['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef8', '--',
'/mock-checkout/third_party/WebKit/LayoutTests/external/wpt']
'/mock-checkout/third_party/WebKit/LayoutTests/external/wpt'],
['git', 'show', '--format=%B', '--no-patch', 'badbeef8']
])

def test_ignores_reverted_commits_with_noexport_true(self):
Expand All @@ -87,7 +88,9 @@ def test_ignores_reverted_commits_with_noexport_true(self):
['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--',
'badbeef8/third_party/WebKit/LayoutTests/external/wpt/'],
['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef8', '--',
'/mock-checkout/third_party/WebKit/LayoutTests/external/wpt']])
'/mock-checkout/third_party/WebKit/LayoutTests/external/wpt'],
['git', 'show', '--format=%B', '--no-patch', 'badbeef8']
])

def test_ignores_commits_that_start_with_import(self):
host = MockHost()
Expand All @@ -105,5 +108,7 @@ def test_ignores_commits_that_start_with_import(self):
['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--',
'badbeef8/third_party/WebKit/LayoutTests/external/wpt/'],
['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef8', '--',
'/mock-checkout/third_party/WebKit/LayoutTests/external/wpt']
'/mock-checkout/third_party/WebKit/LayoutTests/external/wpt'],
['git', 'show', '--format=%B', '--no-patch', 'badbeef8'],
['git', 'show', '--format=%B', '--no-patch', 'badbeef8'],
])
7 changes: 5 additions & 2 deletions third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def create_branch_with_patch(self, message, patch, author):

return self.branch_name

def test_patch(self, patch):
def test_patch(self, patch, chromium_commit=None):
"""Returns the expected output of a patch against origin/master.
Args:
Expand All @@ -120,7 +120,10 @@ def test_patch(self, patch):
self.run(['git', 'add', '.'])
output = self.run(['git', 'diff', 'origin/master'])
except ScriptError:
_log.warning('Patch did not apply cleanly, skipping...')
_log.warning('Patch did not apply cleanly, skipping.')
if chromium_commit:
_log.warning('Commit details:\n%s\n%s', chromium_commit.sha,
chromium_commit.subject())
output = ''

self.clean()
Expand Down

0 comments on commit 4bb102b

Please sign in to comment.