| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 dest_dir_name = CSS_DEST_NAME | 68 dest_dir_name = CSS_DEST_NAME |
| 69 repo_url = CSS_REPO_URL | 69 repo_url = CSS_REPO_URL |
| 70 | 70 |
| 71 # TODO(qyearsley): Simplify this to use LocalWPT.fetch when csswg-test | 71 # TODO(qyearsley): Simplify this to use LocalWPT.fetch when csswg-test |
| 72 # is merged into web-platform-tests. | 72 # is merged into web-platform-tests. |
| 73 temp_repo_path = self.path_from_webkit_base(dest_dir_name) | 73 temp_repo_path = self.path_from_webkit_base(dest_dir_name) |
| 74 _log.info('Cloning repo: %s', repo_url) | 74 _log.info('Cloning repo: %s', repo_url) |
| 75 _log.info('Local path: %s', temp_repo_path) | 75 _log.info('Local path: %s', temp_repo_path) |
| 76 self.run(['git', 'clone', repo_url, temp_repo_path]) | 76 self.run(['git', 'clone', repo_url, temp_repo_path]) |
| 77 | 77 |
| 78 if options.target == 'wpt': | 78 if options.target == 'wpt' and not options.ignore_exportable_commits: |
| 79 commits = self.exportable_but_not_exported_commits(temp_repo_path) | 79 commits = self.exportable_but_not_exported_commits(temp_repo_path) |
| 80 if commits: | 80 if commits: |
| 81 _log.error('There were exportable but not-yet-exported commits:'
) | 81 _log.error('There were exportable but not-yet-exported commits:'
) |
| 82 for commit in commits: | 82 for commit in commits: |
| 83 _log.error(' https://chromium.googlesource.com/chromium/src
/+/%s', commit.sha) | 83 _log.error(' https://chromium.googlesource.com/chromium/src
/+/%s', commit.sha) |
| 84 _log.error('Aborting import to prevent clobbering these commits.
') | 84 _log.error('Aborting import to prevent clobbering these commits.
') |
| 85 self.clean_up_temp_repo(temp_repo_path) | 85 self.clean_up_temp_repo(temp_repo_path) |
| 86 return 1 | 86 return 1 |
| 87 | 87 |
| 88 import_commit = self.update(dest_dir_name, temp_repo_path, options.revis
ion) | 88 import_commit = self.update(dest_dir_name, temp_repo_path, options.revis
ion) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 115 parser.add_argument('--allow-local-commits', action='store_true', | 115 parser.add_argument('--allow-local-commits', action='store_true', |
| 116 help='allow script to run even if we have local comm
its') | 116 help='allow script to run even if we have local comm
its') |
| 117 parser.add_argument('-r', dest='revision', action='store', | 117 parser.add_argument('-r', dest='revision', action='store', |
| 118 help='Target revision.') | 118 help='Target revision.') |
| 119 parser.add_argument('target', choices=['css', 'wpt'], | 119 parser.add_argument('target', choices=['css', 'wpt'], |
| 120 help='Target repository. "css" for csswg-test, "wpt
" for web-platform-tests.') | 120 help='Target repository. "css" for csswg-test, "wpt
" for web-platform-tests.') |
| 121 parser.add_argument('--auto-update', action='store_true', | 121 parser.add_argument('--auto-update', action='store_true', |
| 122 help='uploads CL and initiates commit queue.') | 122 help='uploads CL and initiates commit queue.') |
| 123 parser.add_argument('--auth-refresh-token-json', | 123 parser.add_argument('--auth-refresh-token-json', |
| 124 help='Rietveld auth refresh JSON token.') | 124 help='Rietveld auth refresh JSON token.') |
| 125 parser.add_argument('--ignore-exportable-commits', action='store_true', |
| 126 help='Continue even if there are exportable commits
that may be overwritten.') |
| 125 return parser.parse_args(argv) | 127 return parser.parse_args(argv) |
| 126 | 128 |
| 127 def checkout_is_okay(self, allow_local_commits): | 129 def checkout_is_okay(self, allow_local_commits): |
| 128 git_diff_retcode, _ = self.run(['git', 'diff', '--quiet', 'HEAD'], exit_
on_failure=False) | 130 git_diff_retcode, _ = self.run(['git', 'diff', '--quiet', 'HEAD'], exit_
on_failure=False) |
| 129 if git_diff_retcode: | 131 if git_diff_retcode: |
| 130 _log.warning('Checkout is dirty; aborting.') | 132 _log.warning('Checkout is dirty; aborting.') |
| 131 return False | 133 return False |
| 132 | 134 |
| 133 local_commits = self.run(['git', 'log', '--oneline', 'origin/master..HEA
D'])[1] | 135 local_commits = self.run(['git', 'log', '--oneline', 'origin/master..HEA
D'])[1] |
| 134 if local_commits and not allow_local_commits: | 136 if local_commits and not allow_local_commits: |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" | 442 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" |
| 441 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) | 443 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) |
| 442 renamed_tests = {} | 444 renamed_tests = {} |
| 443 for line in out.splitlines(): | 445 for line in out.splitlines(): |
| 444 _, source_path, dest_path = line.split() | 446 _, source_path, dest_path = line.split() |
| 445 source_test = self.finder.layout_test_name(source_path) | 447 source_test = self.finder.layout_test_name(source_path) |
| 446 dest_test = self.finder.layout_test_name(dest_path) | 448 dest_test = self.finder.layout_test_name(dest_path) |
| 447 if source_test and dest_test: | 449 if source_test and dest_test: |
| 448 renamed_tests[source_test] = dest_test | 450 renamed_tests[source_test] = dest_test |
| 449 return renamed_tests | 451 return renamed_tests |
| OLD | NEW |