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

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

Issue 2655183002: In WPT importer, abort if there are exportable-but-not-yet-exported commits. (Closed)
Patch Set: Rebased Created 3 years, 10 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 """Utility functions used both when importing and exporting.""" 5 """Utility functions used both when importing and exporting."""
6 6
7 import logging 7 import logging
8 8
9 from webkitpy.w3c.chromium_commit import ChromiumCommit 9 from webkitpy.w3c.chromium_commit import ChromiumCommit
10 10
11 11
12 WPT_DEST_NAME = 'wpt' 12 WPT_DEST_NAME = 'wpt'
13 CSS_DEST_NAME = 'csswg-test' 13 CSS_DEST_NAME = 'csswg-test'
14 14
15 # TODO(qyearsley): This directory should be able to be constructed with 15 # TODO(qyearsley): This directory should be able to be constructed with
16 # WebKitFinder and WPT_DEST_NAME, plus the string "external". 16 # WebKitFinder and WPT_DEST_NAME, plus the string "external".
17 CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/external/wpt/' 17 CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/external/wpt/'
18 18
19 # Our mirrors of the official w3c repos, which we pull from. 19 # Our mirrors of the official w3c repos, which we pull from.
20 WPT_REPO_URL = 'https://chromium.googlesource.com/external/w3c/web-platform-test s.git' 20 WPT_REPO_URL = 'https://chromium.googlesource.com/external/w3c/web-platform-test s.git'
21 CSS_REPO_URL = 'https://chromium.googlesource.com/external/w3c/csswg-test.git' 21 CSS_REPO_URL = 'https://chromium.googlesource.com/external/w3c/csswg-test.git'
22 22
23 _log = logging.getLogger(__name__) 23 _log = logging.getLogger(__name__)
24 24
25 25
26 def exportable_commits_since(commit, host, local_wpt): 26 def exportable_commits_since(chromium_commit_hash, host, local_wpt):
27 """Lists exportable commits after a certain point. 27 """Lists exportable commits after a certain point.
28 28
29 Args: 29 Args:
30 commit: The SHA of the Chromium commit from which this method will look. 30 chromium_commit_hash: The SHA of the Chromium commit from which this
31 method will look. This commit is not included in the commits searche d.
31 host: A Host object. 32 host: A Host object.
32 local_wpt: A LocalWPT instance, used to see whether a Chromium commit 33 local_wpt: A LocalWPT instance, used to see whether a Chromium commit
33 can be applied cleanly in the upstream repo. 34 can be applied cleanly in the upstream repo.
34 35
35 Returns: 36 Returns:
36 A list of ChromiumCommit objects for commits that are exportable since 37 A list of ChromiumCommit objects for commits that are exportable after
37 the given commit, in chronological order. 38 the given commit, in chronological order.
38 """ 39 """
39 chromium_repo_root = host.executive.run_command(['git', 'rev-parse', '--show -toplevel']).strip() 40 chromium_repo_root = host.executive.run_command(['git', 'rev-parse', '--show -toplevel']).strip()
40 41
41 wpt_path = chromium_repo_root + '/' + CHROMIUM_WPT_DIR 42 wpt_path = chromium_repo_root + '/' + CHROMIUM_WPT_DIR
42 commit_hashes = host.executive.run_command( 43 commit_range = '{}..HEAD'.format(chromium_commit_hash)
43 ['git', 'rev-list', '{}..HEAD'.format(commit), '--reverse', '--', wpt_pa th]).splitlines() 44 commit_hashes = host.executive.run_command(['git', 'rev-list', commit_range, '--reverse', '--', wpt_path]).splitlines()
44
45 chromium_commits = [ChromiumCommit(host, sha=sha) for sha in commit_hashes] 45 chromium_commits = [ChromiumCommit(host, sha=sha) for sha in commit_hashes]
46 return [c for c in chromium_commits if is_exportable(c, local_wpt)] 46 return [commit for commit in chromium_commits if is_exportable(commit, local _wpt)]
47 47
48 48
49 def is_exportable(chromium_commit, local_wpt): 49 def is_exportable(chromium_commit, local_wpt):
50 """Checks whether a given patch is exportable and can be applied.""" 50 """Checks whether a given patch is exportable and can be applied."""
51 patch = chromium_commit.format_patch() 51 patch = chromium_commit.format_patch()
52 return (patch and 52 return (patch and
53 local_wpt.test_patch(patch) and 53 local_wpt.test_patch(patch) and
54 'NOEXPORT=true' not in chromium_commit.message() and 54 'NOEXPORT=true' not in chromium_commit.message() and
55 not chromium_commit.message().startswith('Import ')) 55 not chromium_commit.message().startswith('Import '))
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698