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

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

Issue 2648783004: Move exportable_commits_since to webkitpy/w3c/common.py. (Closed)
Patch Set: Created 3 years, 11 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
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 """Utility functions used both when importing and exporting."""
6
7 import logging
8
9 from webkitpy.w3c.chromium_commit import ChromiumCommit
10
11
12 WPT_DEST_NAME = 'wpt'
13 CSS_DEST_NAME = 'csswg-test'
14
15 # TODO(qyearsley): This directory should be able to be constructed with
16 # WebKitFinder and WPT_DEST_NAME, plus the string "external".
17 CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/external/wpt/'
18
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'
21 CSS_REPO_URL = 'https://chromium.googlesource.com/external/w3c/csswg-test.git'
22
23 _log = logging.getLogger(__name__)
24
25
26 def exportable_commits_since(commit, host, local_wpt):
27 """Lists exportable commits after a certain point.
28
29 Args:
30 commit: The SHA of the Chromium commit from which this method will look.
31 host: A Host object.
32 local_wpt: A LocalWPT instance, used to see whether a Chromium commit
33 can be applied cleanly in the upstream repo.
34
35 Returns:
36 A list of ChromiumCommit objects for commits that are exportable since
37 the given commit, in chronological order.
38 """
39 chromium_repo_root = host.executive.run_command(['git', 'rev-parse', '--show -toplevel']).strip()
40
41 wpt_path = chromium_repo_root + '/' + CHROMIUM_WPT_DIR
42 commit_hashes = host.executive.run_command(
43 ['git', 'rev-list', '{}..HEAD'.format(commit), '--reverse', '--', wpt_pa th]).splitlines()
44
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)]
47
48
49 def is_exportable(chromium_commit, local_wpt):
50 """Checks whether a given patch is exportable and can be applied."""
51 patch = chromium_commit.format_patch()
52 return (patch and
53 local_wpt.test_patch(patch) and
54 'NOEXPORT=true' not in chromium_commit.message() and
55 not chromium_commit.message().startswith('Import '))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698