| 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 | 7 |
| 9 CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/external/wpt/' | 8 CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/external/wpt/' |
| 10 | 9 |
| 11 | 10 |
| 12 class ChromiumCommit(object): | 11 class ChromiumCommit(object): |
| 13 | 12 |
| 14 def __init__(self, host, sha=None, position=None): | 13 def __init__(self, host, sha=None, position=None): |
| 15 """ | 14 """ |
| 16 Args: | 15 Args: |
| 17 host: A Host object | 16 host: A Host object |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 changed_files = self.host.executive.run_command([ | 73 changed_files = self.host.executive.run_command([ |
| 75 'git', 'diff-tree', '--name-only', '--no-commit-id', '-r', self.sha, | 74 'git', 'diff-tree', '--name-only', '--no-commit-id', '-r', self.sha, |
| 76 '--', self.absolute_chromium_wpt_dir() | 75 '--', self.absolute_chromium_wpt_dir() |
| 77 ]).splitlines() | 76 ]).splitlines() |
| 78 | 77 |
| 79 blacklist = [ | 78 blacklist = [ |
| 80 'MANIFEST.json', | 79 'MANIFEST.json', |
| 81 self.host.filesystem.join('resources', 'testharnessreport.js'), | 80 self.host.filesystem.join('resources', 'testharnessreport.js'), |
| 82 ] | 81 ] |
| 83 qualified_blacklist = [CHROMIUM_WPT_DIR + f for f in blacklist] | 82 qualified_blacklist = [CHROMIUM_WPT_DIR + f for f in blacklist] |
| 84 return [f for f in changed_files if f not in qualified_blacklist and not
DepsUpdater.is_baseline(f)] | 83 |
| 84 return [f for f in changed_files if f not in qualified_blacklist and not
self.is_baseline(f)] |
| 85 |
| 86 @staticmethod |
| 87 def is_baseline(basename): |
| 88 # TODO(qyearsley): Find a better, centralized place for this. |
| 89 return basename.endswith('-expected.txt') |
| 85 | 90 |
| 86 def format_patch(self): | 91 def format_patch(self): |
| 87 """Makes a patch with only exportable changes.""" | 92 """Makes a patch with only exportable changes.""" |
| 88 filtered_files = self.filtered_changed_files() | 93 filtered_files = self.filtered_changed_files() |
| 89 | 94 |
| 90 if not filtered_files: | 95 if not filtered_files: |
| 91 return '' | 96 return '' |
| 92 | 97 |
| 93 return self.host.executive.run_command([ | 98 return self.host.executive.run_command([ |
| 94 'git', 'format-patch', '-1', '--stdout', self.sha, '--' | 99 'git', 'format-patch', '-1', '--stdout', self.sha, '--' |
| 95 ] + filtered_files, cwd=self.absolute_chromium_dir()) | 100 ] + filtered_files, cwd=self.absolute_chromium_dir()) |
| 96 | 101 |
| 97 @memoized | 102 @memoized |
| 98 def absolute_chromium_wpt_dir(self): | 103 def absolute_chromium_wpt_dir(self): |
| 99 finder = WebKitFinder(self.host.filesystem) | 104 finder = WebKitFinder(self.host.filesystem) |
| 100 return finder.path_from_webkit_base('LayoutTests', 'external', 'wpt') | 105 return finder.path_from_webkit_base('LayoutTests', 'external', 'wpt') |
| 101 | 106 |
| 102 @memoized | 107 @memoized |
| 103 def absolute_chromium_dir(self): | 108 def absolute_chromium_dir(self): |
| 104 finder = WebKitFinder(self.host.filesystem) | 109 finder = WebKitFinder(self.host.filesystem) |
| 105 return finder.chromium_base() | 110 return finder.chromium_base() |
| OLD | NEW |