Chromium Code Reviews| Index: third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_commit.py |
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_commit.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_commit.py |
| index f87cb43cd21552d27d9a21fb4265e8c312794431..84848373796ab18f3e7a82aa7fbd069306b3ae34 100644 |
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_commit.py |
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_commit.py |
| @@ -4,6 +4,9 @@ |
| from webkitpy.common.memoized import memoized |
| from webkitpy.common.webkit_finder import WebKitFinder |
| +from webkitpy.w3c.deps_updater import DepsUpdater |
| + |
| +CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/imported/wpt/' |
| class ChromiumCommit(object): |
| @@ -61,16 +64,35 @@ class ChromiumCommit(object): |
| 'git', 'show', '--format=%B', '--no-patch', self.sha |
| ]) |
| - def format_patch(self): |
| + def filtered_changed_files(self): |
| """Makes a patch with just changes in files in the WPT for a given commit.""" |
|
qyearsley
2016/12/19 17:50:08
"in the WPT" -> "in the WPT dir"
|
| - # TODO(jeffcarp): exclude expectations files |
| - # TODO(jeffcarp): exclude manifest files |
| + changed_files = self.host.executive.run_command([ |
| + 'git', 'diff-tree', '--name-only', '--no-commit-id', '-r', self.sha, |
| + '--', self.absolute_chromium_wpt_dir() |
| + ]).splitlines() |
| + |
| + blacklist = ['MANIFEST.json', 'resources/testharnessreport.js'] |
|
qyearsley
2016/12/19 17:50:08
Just in case backslashes might be used on Windows
|
| + qualified_blacklist = [CHROMIUM_WPT_DIR + f for f in blacklist] |
|
qyearsley
2016/12/19 17:50:08
I'm wondering if there's a better word to use here
jeffcarp
2016/12/19 21:19:20
I can't think of anything more fitting but open to
qyearsley
2016/12/21 00:24:46
Yep, sometimes there's no clear proper name for so
|
| + return [f for f in changed_files if f not in qualified_blacklist and not DepsUpdater.is_baseline(f)] |
| + |
| + def format_patch(self): |
| + """Makes a patch with only exportable changes. |
| + """ |
|
qyearsley
2016/12/19 17:50:08
Nit: the closing quote can go on the previous line
|
| + filtered_files = self.filtered_changed_files() |
| + |
| + if not filtered_files: |
| + return '' |
| + |
| return self.host.executive.run_command([ |
| 'git', 'format-patch', '-1', '--stdout', |
| - self.sha, self.absolute_chromium_wpt_dir() |
| - ]) |
| + self.sha, '--'] + filtered_files, cwd=self.absolute_chromium_dir()) |
| @memoized |
| def absolute_chromium_wpt_dir(self): |
| finder = WebKitFinder(self.host.filesystem) |
| return finder.path_from_webkit_base('LayoutTests', 'imported', 'wpt') |
| + |
| + @memoized |
| + def absolute_chromium_dir(self): |
| + finder = WebKitFinder(self.host.filesystem) |
| + return finder.chromium_base() |