Chromium Code Reviews| Index: third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater.py |
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater.py |
| index d56f1682c31ce8048e74391adff42f7825775c3c..16301cddfb632689c2daf8cdfcc32fee3986deb6 100644 |
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater.py |
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater.py |
| @@ -5,10 +5,11 @@ |
| """Pull latest revisions of a W3C test repo and make a local commit.""" |
| import argparse |
| +import time |
| +import sys |
| from webkitpy.common.webkit_finder import WebKitFinder |
| -# Import destination directories (under LayoutTests/imported/). |
|
qyearsley
2016/07/01 17:40:40
Why is this deleted?
|
| WPT_DEST_NAME = 'wpt' |
| CSS_DEST_NAME = 'csswg-test' |
| @@ -24,6 +25,7 @@ class DepsUpdater(object): |
| self.allow_local_commits = False |
| self.keep_w3c_repos_around = False |
| self.target = None |
| + self.auto_update = False |
| def main(self, argv=None): |
| self.parse_args(argv) |
| @@ -60,6 +62,19 @@ class DepsUpdater(object): |
| self.commit_changes_if_needed(chromium_commitish, import_commitish) |
| + if self.auto_update: |
| + self.run(['git', 'cl', 'upload', '-f']) |
| + self.run(['git', 'cl', 'set-commit']) |
| + while True: |
| + ret_code, out = self.run(['git', 'cl', 'try-results']) |
| + del ret_code |
|
qyearsley
2016/07/01 17:40:39
If a function returns a pair, but you don't care a
|
| + results = self.parse_try_job_results(out) |
| + if results['Started'] != set([]): |
| + time.sleep(300) |
|
qyearsley
2016/07/01 17:40:39
In general whenever you see a literal number (othe
|
| + continue |
| + if results['Failures'] != set([]): |
| + sys.exit(2) |
|
qyearsley
2016/07/01 17:40:40
Does exit code 2 have any particular significance?
|
| + break |
| return 0 |
|
qyearsley
2016/07/01 17:40:40
Some cases to think about:
- If there are no sta
|
| def parse_args(self, argv): |
| @@ -73,12 +88,15 @@ class DepsUpdater(object): |
| help='leave the w3c repos around that were imported previously.') |
| parser.add_argument('target', choices=['css', 'wpt'], |
| help='Target repository. "css" for csswg-test, "wpt" for web-platform-tests.') |
| + parser.add_argument('--auto-update', action='store_true', |
|
qyearsley
2016/07/01 17:40:40
The CL description says "--auto-import" and this s
|
| + help='uploads cl and initiates commit queue.') |
|
qyearsley
2016/07/01 17:40:40
cl -> CL
|
| args = parser.parse_args(argv) |
| self.allow_local_commits = args.allow_local_commits |
| self.keep_w3c_repos_around = args.keep_w3c_repos_around |
| self.verbose = args.verbose |
| self.target = args.target |
| + self.auto_update = args.auto_update |
| def checkout_is_okay(self): |
| git_diff_retcode, _ = self.run(['git', 'diff', '--quiet', 'HEAD'], exit_on_failure=False) |
| @@ -222,3 +240,14 @@ class DepsUpdater(object): |
| def print_(self, msg): |
| self.host.print_(msg) |
| + |
| + def parse_try_job_results(self, results): |
|
qyearsley
2016/07/01 17:40:40
You could consider adding a docstring for this fun
|
| + fields = ['Successes:', 'Started:', 'Scheduled:', 'Failures:'] |
| + sets = {'Successes': set(), 'Started': set(), 'Scheduled': set(), 'Failures': set()} |
| + for line in results.splitlines(): |
| + if line in fields: |
| + temp = line[:len(line)] |
|
qyearsley
2016/07/01 17:40:40
`temp` isn't a very meaningful name (http://c2.com
|
| + else: |
| + sets[temp].add(line.split()[1]) |
|
qyearsley
2016/07/01 17:40:40
At the bottom of the output it also prints
"Total:
|
| + sets['Failures'] -= sets['Successes'] |
| + return sets |