| 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 attempt to | 7 If this script is given the argument --auto-update, it will also attempt to |
| 8 upload a CL, triggery try jobs, and make any changes that are required for | 8 upload a CL, triggery try jobs, and make any changes that are required for |
| 9 new failing tests before committing. | 9 new failing tests before committing. |
| 10 """ | 10 """ |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 if self.git_cl.has_failing_try_results(try_results): | 319 if self.git_cl.has_failing_try_results(try_results): |
| 320 _log.info('CQ failed; aborting.') | 320 _log.info('CQ failed; aborting.') |
| 321 self.git_cl.run(['set-close']) | 321 self.git_cl.run(['set-close']) |
| 322 return False | 322 return False |
| 323 _log.info('Update completed.') | 323 _log.info('Update completed.') |
| 324 return True | 324 return True |
| 325 | 325 |
| 326 def _upload_cl(self): | 326 def _upload_cl(self): |
| 327 _log.info('Uploading change list.') | 327 _log.info('Uploading change list.') |
| 328 cc_list = self.get_directory_owners_to_cc() | 328 cc_list = self.get_directory_owners_to_cc() |
| 329 last_commit_message = self.check_run(['git', 'log', '-1', '--format=%B']
) | 329 description = self._cl_description() |
| 330 commit_message = last_commit_message + 'TBR=qyearsley@chromium.org' | |
| 331 self.git_cl.run([ | 330 self.git_cl.run([ |
| 332 'upload', | 331 'upload', |
| 333 '-f', | 332 '-f', |
| 334 '--rietveld', | 333 '--rietveld', |
| 335 '-m', | 334 '-m', |
| 336 commit_message, | 335 description, |
| 337 ] + ['--cc=' + email for email in cc_list]) | 336 ] + ['--cc=' + email for email in cc_list]) |
| 338 | 337 |
| 338 def _cl_description(self): |
| 339 description = self.check_run(['git', 'log', '-1', '--format=%B']) |
| 340 build_link = self._build_link() |
| 341 if build_link: |
| 342 description += 'Build: %s\n\n' % build_link |
| 343 description += 'TBR=qyearsley@chromium.org' |
| 344 return description |
| 345 |
| 346 def _build_link(self): |
| 347 """Returns a link to a job, if running on buildbot.""" |
| 348 master_name = self.host.environ.get('BUILDBOT_MASTERNAME') |
| 349 builder_name = self.host.environ.get('BUILDBOT_BUILDERNAME') |
| 350 build_number = self.host.environ.get('BUILDBOT_BUILDNUMBER') |
| 351 if not (master_name and builder_name and build_number): |
| 352 return None |
| 353 return 'https://build.chromium.org/p/%s/builders/%s/builds/%s' % (master
_name, builder_name, build_number) |
| 354 |
| 339 def get_directory_owners_to_cc(self): | 355 def get_directory_owners_to_cc(self): |
| 340 """Returns a list of email addresses to CC for the current import.""" | 356 """Returns a list of email addresses to CC for the current import.""" |
| 341 _log.info('Gathering directory owners emails to CC.') | 357 _log.info('Gathering directory owners emails to CC.') |
| 342 directory_owners_file_path = self.finder.path_from_webkit_base( | 358 directory_owners_file_path = self.finder.path_from_webkit_base( |
| 343 'Tools', 'Scripts', 'webkitpy', 'w3c', 'directory_owners.json') | 359 'Tools', 'Scripts', 'webkitpy', 'w3c', 'directory_owners.json') |
| 344 with open(directory_owners_file_path) as data_file: | 360 with open(directory_owners_file_path) as data_file: |
| 345 directory_to_owner = self.parse_directory_owners(json.load(data_file
)) | 361 directory_to_owner = self.parse_directory_owners(json.load(data_file
)) |
| 346 out = self.check_run(['git', 'diff', 'origin/master', '--name-only']) | 362 out = self.check_run(['git', 'diff', 'origin/master', '--name-only']) |
| 347 changed_files = out.splitlines() | 363 changed_files = out.splitlines() |
| 348 return self.generate_email_list(changed_files, directory_to_owner) | 364 return self.generate_email_list(changed_files, directory_to_owner) |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" | 445 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" |
| 430 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) | 446 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) |
| 431 renamed_tests = {} | 447 renamed_tests = {} |
| 432 for line in out.splitlines(): | 448 for line in out.splitlines(): |
| 433 _, source_path, dest_path = line.split() | 449 _, source_path, dest_path = line.split() |
| 434 source_test = self.finder.layout_test_name(source_path) | 450 source_test = self.finder.layout_test_name(source_path) |
| 435 dest_test = self.finder.layout_test_name(dest_path) | 451 dest_test = self.finder.layout_test_name(dest_path) |
| 436 if source_test and dest_test: | 452 if source_test and dest_test: |
| 437 renamed_tests[source_test] = dest_test | 453 renamed_tests[source_test] = dest_test |
| 438 return renamed_tests | 454 return renamed_tests |
| OLD | NEW |