| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """Fetches a copy of the latest state of a W3C test repository and commits. | 5 """Fetches a copy of the latest state of a W3C test repository and commits. |
| 6 | 6 |
| 7 If this script is given the argument --auto-update, it will also: | 7 If this script is given the argument --auto-update, it will also: |
| 8 1. Upload a CL. | 8 1. Upload a CL. |
| 9 2. Trigger try jobs and wait for them to complete. | 9 2. Trigger try jobs and wait for them to complete. |
| 10 3. Make any changes that are required for new failing tests. | 10 3. Make any changes that are required for new failing tests. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 def main(self, argv=None): | 49 def main(self, argv=None): |
| 50 options = self.parse_args(argv) | 50 options = self.parse_args(argv) |
| 51 self.verbose = options.verbose | 51 self.verbose = options.verbose |
| 52 log_level = logging.DEBUG if self.verbose else logging.INFO | 52 log_level = logging.DEBUG if self.verbose else logging.INFO |
| 53 logging.basicConfig(level=log_level, format='%(message)s') | 53 logging.basicConfig(level=log_level, format='%(message)s') |
| 54 | 54 |
| 55 if not self.checkout_is_okay(options.allow_local_commits): | 55 if not self.checkout_is_okay(options.allow_local_commits): |
| 56 return 1 | 56 return 1 |
| 57 | 57 |
| 58 self.git_cl = GitCL(self.host) | 58 self.git_cl = GitCL(self.host, auth_refresh_token_json=options.auth_refr
esh_token_json) |
| 59 | 59 |
| 60 _log.debug('Noting the current Chromium commit.') | 60 _log.debug('Noting the current Chromium commit.') |
| 61 _, show_ref_output = self.run(['git', 'show-ref', 'HEAD']) | 61 _, show_ref_output = self.run(['git', 'show-ref', 'HEAD']) |
| 62 chromium_commit = show_ref_output.split()[0] | 62 chromium_commit = show_ref_output.split()[0] |
| 63 | 63 |
| 64 assert options.target in ('wpt', 'css') | 64 assert options.target in ('wpt', 'css') |
| 65 dest_dir_name = WPT_DEST_NAME | 65 dest_dir_name = WPT_DEST_NAME |
| 66 repo_url = WPT_REPO_URL | 66 repo_url = WPT_REPO_URL |
| 67 if options.target != 'wpt': | 67 if options.target != 'wpt': |
| 68 dest_dir_name = CSS_DEST_NAME | 68 dest_dir_name = CSS_DEST_NAME |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 help='log what we are doing') | 117 help='log what we are doing') |
| 118 parser.add_argument('--allow-local-commits', action='store_true', | 118 parser.add_argument('--allow-local-commits', action='store_true', |
| 119 help='allow script to run even if we have local comm
its') | 119 help='allow script to run even if we have local comm
its') |
| 120 parser.add_argument('-r', dest='revision', action='store', | 120 parser.add_argument('-r', dest='revision', action='store', |
| 121 help='Target revision.') | 121 help='Target revision.') |
| 122 parser.add_argument('target', choices=['css', 'wpt'], | 122 parser.add_argument('target', choices=['css', 'wpt'], |
| 123 help='Target repository. "css" for csswg-test, "wpt
" for web-platform-tests.') | 123 help='Target repository. "css" for csswg-test, "wpt
" for web-platform-tests.') |
| 124 parser.add_argument('--auto-update', action='store_true', | 124 parser.add_argument('--auto-update', action='store_true', |
| 125 help='uploads CL and initiates commit queue.') | 125 help='uploads CL and initiates commit queue.') |
| 126 parser.add_argument('--auth-refresh-token-json', | 126 parser.add_argument('--auth-refresh-token-json', |
| 127 help='Auth refresh JSON token (ignored, deprecated)'
) | 127 help='authentication refresh token JSON file, ' |
| 128 'used for authentication for try jobs, ' |
| 129 'generally not necessary on developer machines'
) |
| 128 parser.add_argument('--ignore-exportable-commits', action='store_true', | 130 parser.add_argument('--ignore-exportable-commits', action='store_true', |
| 129 help='Continue even if there are exportable commits
that may be overwritten.') | 131 help='Continue even if there are exportable commits
that may be overwritten.') |
| 130 return parser.parse_args(argv) | 132 return parser.parse_args(argv) |
| 131 | 133 |
| 132 def checkout_is_okay(self, allow_local_commits): | 134 def checkout_is_okay(self, allow_local_commits): |
| 133 git_diff_retcode, _ = self.run(['git', 'diff', '--quiet', 'HEAD'], exit_
on_failure=False) | 135 git_diff_retcode, _ = self.run(['git', 'diff', '--quiet', 'HEAD'], exit_
on_failure=False) |
| 134 if git_diff_retcode: | 136 if git_diff_retcode: |
| 135 _log.warning('Checkout is dirty; aborting.') | 137 _log.warning('Checkout is dirty; aborting.') |
| 136 return False | 138 return False |
| 137 | 139 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" | 467 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" |
| 466 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) | 468 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) |
| 467 renamed_tests = {} | 469 renamed_tests = {} |
| 468 for line in out.splitlines(): | 470 for line in out.splitlines(): |
| 469 _, source_path, dest_path = line.split() | 471 _, source_path, dest_path = line.split() |
| 470 source_test = self.finder.layout_test_name(source_path) | 472 source_test = self.finder.layout_test_name(source_path) |
| 471 dest_test = self.finder.layout_test_name(dest_path) | 473 dest_test = self.finder.layout_test_name(dest_path) |
| 472 if source_test and dest_test: | 474 if source_test and dest_test: |
| 473 renamed_tests[source_test] = dest_test | 475 renamed_tests[source_test] = dest_test |
| 474 return renamed_tests | 476 return renamed_tests |
| OLD | NEW |