Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_commit.py

Issue 2544173002: Skip commits that don't generate a patch + fixes to get export working (Closed)
Patch Set: Merge ChromiumWPT functionality into TestExporter, expose exportable_commits Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 7
8 WPT_DIR = 'third_party/WebKit/LayoutTests/imported/wpt/'
9
8 10
9 class ChromiumCommit(object): 11 class ChromiumCommit(object):
10 12
11 def __init__(self, host, sha=None, position=None): 13 def __init__(self, host, sha=None, position=None):
12 """ 14 """
13 Args: 15 Args:
14 host: A Host object 16 host: A Host object
15 sha: A Chromium commit SHA 17 sha: A Chromium commit SHA
16 position: A string of the form: 18 position: A string of the form:
17 'Cr-Commit-Position: refs/heads/master@{#431915}' 19 'Cr-Commit-Position: refs/heads/master@{#431915}'
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return self.host.executive.run_command([ 56 return self.host.executive.run_command([
55 'git', 'show', '--format=%b', '--no-patch', self.sha 57 'git', 'show', '--format=%b', '--no-patch', self.sha
56 ]) 58 ])
57 59
58 def message(self): 60 def message(self):
59 """Returns a string with a commit's subject and body.""" 61 """Returns a string with a commit's subject and body."""
60 return self.host.executive.run_command([ 62 return self.host.executive.run_command([
61 'git', 'show', '--format=%B', '--no-patch', self.sha 63 'git', 'show', '--format=%B', '--no-patch', self.sha
62 ]) 64 ])
63 65
66 def filtered_changed_files(self):
67 """Makes a patch with just changes in files in the WPT for a given commi t."""
68
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']
75 qualified_blacklist = [WPT_DIR + f for f in blacklist]
76 # TODO(jeffcarp): use DepsUpdater.is_baseline
77 return [f for f in changed_files if f not in qualified_blacklist and not f.endswith('expected.txt')]
78
64 def format_patch(self): 79 def format_patch(self):
65 """Makes a patch with just changes in files in the WPT for a given commi t.""" 80 """Makes a patch with only exportable changes.
66 # TODO(jeffcarp): exclude expectations files 81 """
67 # TODO(jeffcarp): exclude manifest files 82 filtered_files = self.filtered_changed_files()
83
84 if not filtered_files:
85 return ''
86
68 return self.host.executive.run_command([ 87 return self.host.executive.run_command([
69 'git', 'format-patch', '-1', '--stdout', 88 'git', 'format-patch', '-1', '--stdout',
70 self.sha, self.absolute_chromium_wpt_dir() 89 self.sha, '--'
71 ]) 90 ] + filtered_files, cwd=self.absolute_chromium_dir())
72 91
73 @memoized 92 @memoized
74 def absolute_chromium_wpt_dir(self): 93 def absolute_chromium_wpt_dir(self):
75 finder = WebKitFinder(self.host.filesystem) 94 finder = WebKitFinder(self.host.filesystem)
76 return finder.path_from_webkit_base('LayoutTests', 'imported', 'wpt') 95 return finder.path_from_webkit_base('LayoutTests', 'imported', 'wpt')
96
97 @memoized
98 def absolute_chromium_dir(self):
99 finder = WebKitFinder(self.host.filesystem)
100 return finder.chromium_base()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698