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

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

Issue 2690333005: [WPT Export] Fix remaining Git working directory bugs (Closed)
Patch Set: 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
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 from webkitpy.w3c.chromium_finder import absolute_chromium_dir
10 11
11 12
12 WPT_DEST_NAME = 'wpt' 13 WPT_DEST_NAME = 'wpt'
13 CSS_DEST_NAME = 'csswg-test' 14 CSS_DEST_NAME = 'csswg-test'
14 15
15 # TODO(qyearsley): This directory should be able to be constructed with 16 # TODO(qyearsley): This directory should be able to be constructed with
16 # WebKitFinder and WPT_DEST_NAME, plus the string "external". 17 # WebKitFinder and WPT_DEST_NAME, plus the string "external".
17 CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/external/wpt/' 18 CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/external/wpt/'
18 19
19 # Our mirrors of the official w3c repos, which we pull from. 20 # Our mirrors of the official w3c repos, which we pull from.
(...skipping 10 matching lines...) Expand all
30 chromium_commit_hash: The SHA of the Chromium commit from which this 31 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. 32 method will look. This commit is not included in the commits searche d.
32 host: A Host object. 33 host: A Host object.
33 local_wpt: A LocalWPT instance, used to see whether a Chromium commit 34 local_wpt: A LocalWPT instance, used to see whether a Chromium commit
34 can be applied cleanly in the upstream repo. 35 can be applied cleanly in the upstream repo.
35 36
36 Returns: 37 Returns:
37 A list of ChromiumCommit objects for commits that are exportable after 38 A list of ChromiumCommit objects for commits that are exportable after
38 the given commit, in chronological order. 39 the given commit, in chronological order.
39 """ 40 """
40 chromium_repo_root = host.executive.run_command(['git', 'rev-parse', '--show -toplevel']).strip() 41 chromium_repo_root = host.executive.run_command([
42 'git', 'rev-parse', '--show-toplevel'
43 ], cwd=absolute_chromium_dir(host)).strip()
41 44
42 wpt_path = chromium_repo_root + '/' + CHROMIUM_WPT_DIR 45 wpt_path = chromium_repo_root + '/' + CHROMIUM_WPT_DIR
43 commit_range = '{}..HEAD'.format(chromium_commit_hash) 46 commit_range = '{}..HEAD'.format(chromium_commit_hash)
44 commit_hashes = host.executive.run_command(['git', 'rev-list', commit_range, '--reverse', '--', wpt_path]).splitlines() 47 commit_hashes = host.executive.run_command([
48 'git', 'rev-list', commit_range, '--reverse', '--', wpt_path
49 ], cwd=absolute_chromium_dir(host)).splitlines()
45 chromium_commits = [ChromiumCommit(host, sha=sha) for sha in commit_hashes] 50 chromium_commits = [ChromiumCommit(host, sha=sha) for sha in commit_hashes]
46 return [commit for commit in chromium_commits if is_exportable(commit, local _wpt)] 51 return [commit for commit in chromium_commits if is_exportable(commit, local _wpt)]
47 52
48 53
49 def is_exportable(chromium_commit, local_wpt): 54 def is_exportable(chromium_commit, local_wpt):
50 """Checks whether a given patch is exportable and can be applied.""" 55 """Checks whether a given patch is exportable and can be applied."""
51 patch = chromium_commit.format_patch() 56 patch = chromium_commit.format_patch()
52 return ('NOEXPORT=true' not in chromium_commit.message() and 57 return ('NOEXPORT=true' not in chromium_commit.message() and
53 not chromium_commit.message().startswith('Import ') and 58 not chromium_commit.message().startswith('Import ') and
54 patch and 59 patch and
55 local_wpt.test_patch(patch, chromium_commit)) 60 local_wpt.test_patch(patch, chromium_commit))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698