| Index: third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_wpt.py
|
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_wpt.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_wpt.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..42466e5b4ca1e6a70331bb0bb0fc283a2d27c3bb
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_wpt.py
|
| @@ -0,0 +1,55 @@
|
| +# Copyright 2016 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +import os
|
| +
|
| +CR_WPT_DIR = 'third_party/WebKit/LayoutTests/imported/wpt/'
|
| +
|
| +
|
| +class ChromiumWPT(object):
|
| +
|
| + def __init__(self, host):
|
| + self.host = host
|
| + self.absolute_chromium_wpt_dir = os.path.abspath(os.path.join('..', '..', 'LayoutTests', 'imported', 'wpt'))
|
| +
|
| + def exportable_commits_since(self, sha):
|
| + cr_commits = self.cr_commits_since(sha)
|
| + return filter(self.has_changes_in_wpt, cr_commits)
|
| +
|
| + def has_changes_in_wpt(self, sha):
|
| + """Returns if a Chromium sha has changed files in
|
| + LayoutTests/imported/wpt unless they're expectations
|
| + """
|
| + assert sha
|
| +
|
| + diff_files = self.host.executive.run_command([
|
| + 'git', 'diff-tree', '--no-commit-id',
|
| + '--name-only', '-r', '{}'.format(sha)
|
| + ])
|
| +
|
| + files = [f.strip() for f in filter(bool, diff_files.split('\n'))]
|
| + return any([f.startswith(CR_WPT_DIR) and '-expected' not in f for f in files])
|
| +
|
| + def cr_commits_since(self, sha):
|
| + commits = self.host.executive.run_command([
|
| + 'git', 'rev-list', '--reverse', '{}..HEAD'.format(sha)
|
| + ])
|
| + return filter(bool, commits.split('\n'))
|
| +
|
| + def subject(self, sha):
|
| + return self.host.executive.run_command([
|
| + 'git', 'show', sha, '--format=%s', '--no-patch'
|
| + ])
|
| +
|
| + def message(self, sha):
|
| + return self.host.executive.run_command([
|
| + 'git', 'show', sha, '--format=%B', '--no-patch'
|
| + ])
|
| +
|
| + def wpt_diff_patch(self, sha):
|
| + """Get patch but only for files in LayoutTests/imported/wpt"""
|
| + return self.host.executive.run_command([
|
| + 'git', 'format-patch', '-1', '--stdout',
|
| + '{}'.format(sha), self.absolute_chromium_wpt_dir
|
| + ])
|
|
|