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

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

Issue 2439153002: Script for exporting WPT (Closed)
Patch Set: Linting Created 4 years, 1 month 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
(Empty)
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
3 # found in the LICENSE file.
4
5 import os
6
7 CR_WPT_DIR = 'third_party/WebKit/LayoutTests/imported/wpt/'
8
9
10 class ChromiumWPT(object):
11
12 def __init__(self, host):
13 self.host = host
14 self.absolute_chromium_wpt_dir = os.path.abspath(os.path.join('..', '..' , 'LayoutTests', 'imported', 'wpt'))
15
16 def exportable_commits_since(self, sha):
17 cr_commits = self.cr_commits_since(sha)
18 return filter(self.has_changes_in_wpt, cr_commits)
19
20 def has_changes_in_wpt(self, sha):
21 """Returns if a Chromium sha has changed files in
22 LayoutTests/imported/wpt unless they're expectations
23 """
24 assert sha
25
26 diff_files = self.host.executive.run_command([
27 'git', 'diff-tree', '--no-commit-id',
28 '--name-only', '-r', '{}'.format(sha)
29 ])
30
31 files = [f.strip() for f in filter(bool, diff_files.split('\n'))]
32 return any([f.startswith(CR_WPT_DIR) and '-expected' not in f for f in f iles])
33
34 def cr_commits_since(self, sha):
35 commits = self.host.executive.run_command([
36 'git', 'rev-list', '--reverse', '{}..HEAD'.format(sha)
37 ])
38 return filter(bool, commits.split('\n'))
39
40 def subject(self, sha):
41 return self.host.executive.run_command([
42 'git', 'show', sha, '--format=%s', '--no-patch'
43 ])
44
45 def message(self, sha):
46 return self.host.executive.run_command([
47 'git', 'show', sha, '--format=%B', '--no-patch'
48 ])
49
50 def wpt_diff_patch(self, sha):
51 """Get patch but only for files in LayoutTests/imported/wpt"""
52 return self.host.executive.run_command([
53 'git', 'format-patch', '-1', '--stdout',
54 '{}'.format(sha), self.absolute_chromium_wpt_dir
55 ])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698