OLD | NEW |
---|---|
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from webkitpy.common.memoized import memoized | 5 from webkitpy.common.memoized import memoized |
6 from webkitpy.common.webkit_finder import WebKitFinder | 6 from webkitpy.common.webkit_finder import WebKitFinder |
7 from webkitpy.w3c.deps_updater import DepsUpdater | |
8 | |
9 CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/imported/wpt/' | |
7 | 10 |
8 | 11 |
9 class ChromiumCommit(object): | 12 class ChromiumCommit(object): |
10 | 13 |
11 def __init__(self, host, sha=None, position=None): | 14 def __init__(self, host, sha=None, position=None): |
12 """ | 15 """ |
13 Args: | 16 Args: |
14 host: A Host object | 17 host: A Host object |
15 sha: A Chromium commit SHA | 18 sha: A Chromium commit SHA |
16 position: A string of the form: | 19 position: A string of the form: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 return self.host.executive.run_command([ | 57 return self.host.executive.run_command([ |
55 'git', 'show', '--format=%b', '--no-patch', self.sha | 58 'git', 'show', '--format=%b', '--no-patch', self.sha |
56 ]) | 59 ]) |
57 | 60 |
58 def message(self): | 61 def message(self): |
59 """Returns a string with a commit's subject and body.""" | 62 """Returns a string with a commit's subject and body.""" |
60 return self.host.executive.run_command([ | 63 return self.host.executive.run_command([ |
61 'git', 'show', '--format=%B', '--no-patch', self.sha | 64 'git', 'show', '--format=%B', '--no-patch', self.sha |
62 ]) | 65 ]) |
63 | 66 |
67 def filtered_changed_files(self): | |
68 """Makes a patch with just changes in files in the WPT for a given commi t.""" | |
qyearsley
2016/12/19 17:50:08
"in the WPT" -> "in the WPT dir"
| |
69 changed_files = self.host.executive.run_command([ | |
70 'git', 'diff-tree', '--name-only', '--no-commit-id', '-r', self.sha, | |
71 '--', self.absolute_chromium_wpt_dir() | |
72 ]).splitlines() | |
73 | |
74 blacklist = ['MANIFEST.json', 'resources/testharnessreport.js'] | |
qyearsley
2016/12/19 17:50:08
Just in case backslashes might be used on Windows
| |
75 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
| |
76 return [f for f in changed_files if f not in qualified_blacklist and not DepsUpdater.is_baseline(f)] | |
77 | |
64 def format_patch(self): | 78 def format_patch(self): |
65 """Makes a patch with just changes in files in the WPT for a given commi t.""" | 79 """Makes a patch with only exportable changes. |
66 # TODO(jeffcarp): exclude expectations files | 80 """ |
qyearsley
2016/12/19 17:50:08
Nit: the closing quote can go on the previous line
| |
67 # TODO(jeffcarp): exclude manifest files | 81 filtered_files = self.filtered_changed_files() |
82 | |
83 if not filtered_files: | |
84 return '' | |
85 | |
68 return self.host.executive.run_command([ | 86 return self.host.executive.run_command([ |
69 'git', 'format-patch', '-1', '--stdout', | 87 'git', 'format-patch', '-1', '--stdout', |
70 self.sha, self.absolute_chromium_wpt_dir() | 88 self.sha, '--'] + filtered_files, cwd=self.absolute_chromium_dir()) |
71 ]) | |
72 | 89 |
73 @memoized | 90 @memoized |
74 def absolute_chromium_wpt_dir(self): | 91 def absolute_chromium_wpt_dir(self): |
75 finder = WebKitFinder(self.host.filesystem) | 92 finder = WebKitFinder(self.host.filesystem) |
76 return finder.path_from_webkit_base('LayoutTests', 'imported', 'wpt') | 93 return finder.path_from_webkit_base('LayoutTests', 'imported', 'wpt') |
94 | |
95 @memoized | |
96 def absolute_chromium_dir(self): | |
97 finder = WebKitFinder(self.host.filesystem) | |
98 return finder.chromium_base() | |
OLD | NEW |