Chromium Code Reviews| 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 import os.path | |
| 6 | |
| 5 from webkitpy.w3c.chromium_finder import absolute_chromium_dir, absolute_chromiu m_wpt_dir | 7 from webkitpy.w3c.chromium_finder import absolute_chromium_dir, absolute_chromiu m_wpt_dir |
| 6 | 8 |
| 7 CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/external/wpt/' | 9 CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/external/wpt/' |
| 8 | 10 |
| 9 | 11 |
| 10 class ChromiumCommit(object): | 12 class ChromiumCommit(object): |
| 11 | 13 |
| 12 def __init__(self, host, sha=None, position=None): | 14 def __init__(self, host, sha=None, position=None): |
| 13 """ | 15 """ |
| 14 Args: | 16 Args: |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 'git', 'diff-tree', '--name-only', '--no-commit-id', '-r', self.sha, | 82 'git', 'diff-tree', '--name-only', '--no-commit-id', '-r', self.sha, |
| 81 '--', self.absolute_chromium_wpt_dir | 83 '--', self.absolute_chromium_wpt_dir |
| 82 ], cwd=self.absolute_chromium_dir).splitlines() | 84 ], cwd=self.absolute_chromium_dir).splitlines() |
| 83 | 85 |
| 84 blacklist = [ | 86 blacklist = [ |
| 85 'MANIFEST.json', | 87 'MANIFEST.json', |
| 86 self.host.filesystem.join('resources', 'testharnessreport.js'), | 88 self.host.filesystem.join('resources', 'testharnessreport.js'), |
| 87 ] | 89 ] |
| 88 qualified_blacklist = [CHROMIUM_WPT_DIR + f for f in blacklist] | 90 qualified_blacklist = [CHROMIUM_WPT_DIR + f for f in blacklist] |
| 89 | 91 |
| 90 return [f for f in changed_files if f not in qualified_blacklist and not self.is_baseline(f)] | 92 is_ignored = lambda f: ( |
| 93 f in qualified_blacklist or | |
| 94 self.is_baseline(f) or | |
| 95 # See http://crbug.com/702283 for context. | |
| 96 os.path.basename(f) == 'OWNERS') | |
|
qyearsley
2017/03/28 14:49:29
If you use self.host.filesystem.basename() here, t
Sergiy Byelozyorov
2017/03/28 17:36:13
Done.
| |
| 97 return [f for f in changed_files if not is_ignored(f)] | |
| 91 | 98 |
| 92 @staticmethod | 99 @staticmethod |
| 93 def is_baseline(basename): | 100 def is_baseline(basename): |
| 94 # TODO(qyearsley): Find a better, centralized place for this. | 101 # TODO(qyearsley): Find a better, centralized place for this. |
| 95 return basename.endswith('-expected.txt') | 102 return basename.endswith('-expected.txt') |
| 96 | 103 |
| 97 def format_patch(self): | 104 def format_patch(self): |
| 98 """Makes a patch with only exportable changes.""" | 105 """Makes a patch with only exportable changes.""" |
| 99 filtered_files = self.filtered_changed_files() | 106 filtered_files = self.filtered_changed_files() |
| 100 | 107 |
| 101 if not filtered_files: | 108 if not filtered_files: |
| 102 return '' | 109 return '' |
| 103 | 110 |
| 104 return self.host.executive.run_command([ | 111 return self.host.executive.run_command([ |
| 105 'git', 'format-patch', '-1', '--stdout', self.sha, '--' | 112 'git', 'format-patch', '-1', '--stdout', self.sha, '--' |
| 106 ] + filtered_files, cwd=self.absolute_chromium_dir) | 113 ] + filtered_files, cwd=self.absolute_chromium_dir) |
| OLD | NEW |