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

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

Issue 2518313003: Refactor WPT Export to ensure only one PR in flight at a time (Closed)
Patch Set: Add label 'Automated Chromium Export' to all new PRs 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 """A script for exporting and importing changes between the Chromium repo 5 """A script for exporting and importing changes between the Chromium repo
6 and the web-platform-tests repo. 6 and the web-platform-tests repo.
7 7
8 TODO(jeffcarp): does not handle reverted changes right now 8 TODO(jeffcarp): does not handle reverted changes right now
9 TODO(jeffcarp): it also doesn't handle changes to -expected.html files 9 TODO(jeffcarp): it also doesn't handle changes to -expected.html files
10 TODO(jeffcarp): Currently this script only does export; also add an option 10 TODO(jeffcarp): Currently this script only does export; also add an option
11 import as well. 11 import as well.
12 """ 12 """
13 13
14 import argparse 14 import argparse
15 import logging 15 import logging
16 16
17 from webkitpy.common.host import Host 17 from webkitpy.common.host import Host
18 from webkitpy.common.system.executive import ScriptError 18 from webkitpy.w3c.wpt_github import WPTGitHub
19 from webkitpy.w3c.chromium_commit import ChromiumCommit 19 from webkitpy.w3c.test_exporter import TestExporter
20 from webkitpy.w3c.chromium_wpt import ChromiumWPT
21 from webkitpy.w3c.github import GitHub
22 from webkitpy.w3c.local_wpt import LocalWPT
23 from webkitpy.w3c.test_importer import configure_logging 20 from webkitpy.w3c.test_importer import configure_logging
24 21
25 _log = logging.getLogger(__name__) 22 _log = logging.getLogger(__name__)
26 23
27 24
28 def main(): 25 def main():
29 configure_logging() 26 configure_logging()
30 options = parse_args() 27 options = parse_args()
31 host = Host() 28 host = Host()
32 github = GitHub(host) 29 wpt_github = WPTGitHub(host)
33 30
34 local_wpt = LocalWPT(host, no_fetch=options.no_fetch, use_github=True) 31 # TODO: TE unit test for options.dry_run
jeffcarp 2016/11/29 19:00:48 This is done I will remove it.
35 chromium_wpt = ChromiumWPT(host) 32 test_exporter = TestExporter(host, wpt_github, dry_run=options.dry_run)
36 33 test_exporter.run()
37 wpt_commit, chromium_commit = local_wpt.most_recent_chromium_commit()
38 assert chromium_commit, 'No Chromium commit found, this is impossible'
39
40 _log.info('web-platform-tests@%s (%d behind origin/master)',
41 wpt_commit, local_wpt.commits_behind_master(wpt_commit))
42 _log.info('chromium@%s (%d behind origin/master)',
43 chromium_commit.sha, chromium_commit.num_behind_master())
44
45 exportable_commits = chromium_wpt.exportable_commits_since(chromium_commit.s ha)
46
47 if exportable_commits:
48 _log.info('Found %s exportable commits in chromium:', len(exportable_com mits))
49 for commit in exportable_commits:
50 _log.info('- %s %s', commit, chromium_wpt.subject(commit))
51 else:
52 _log.info('No exportable commits found in Chromium, stopping.')
53 return
54
55 for commit in exportable_commits:
56 _log.info('Uploading %s', chromium_wpt.subject(commit))
57 chromium_commit = ChromiumCommit(host, sha=commit)
58
59 patch = chromium_wpt.format_patch(commit)
60 message = chromium_wpt.message(commit)
61
62 local_wpt.create_branch_with_patch(branch_name, message, patch)
63
64 github.create_pr(
65 local_branch_name='chromium-try-{}'.format(commit),
66 desc_title=chromium_commit.subject(),
67 body=chromium_commit.body())
68 34
69 35
70 def parse_args(): 36 def parse_args():
71 parser = argparse.ArgumentParser(description='WPT Sync') 37 parser = argparse.ArgumentParser(description='WPT Sync')
72 parser.add_argument('--no-fetch', action='store_true') 38 parser.add_argument('--no-fetch', action='store_true')
39 parser.add_argument('--dry-run', action='store_true')
73 return parser.parse_args() 40 return parser.parse_args()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698