| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 def _upload_cl(self): | 367 def _upload_cl(self): |
| 368 _log.info('Uploading change list.') | 368 _log.info('Uploading change list.') |
| 369 directory_owners = self.get_directory_owners() | 369 directory_owners = self.get_directory_owners() |
| 370 description = self._cl_description(directory_owners) | 370 description = self._cl_description(directory_owners) |
| 371 self.git_cl.run([ | 371 self.git_cl.run([ |
| 372 'upload', | 372 'upload', |
| 373 '-f', | 373 '-f', |
| 374 '--gerrit', | 374 '--gerrit', |
| 375 '-m', | 375 '-m', |
| 376 description, | 376 description, |
| 377 ] + ['--cc=' + email_address for email_address in directory_owners]) | 377 ] + self._cc_part(directory_owners)) |
| 378 |
| 379 @staticmethod |
| 380 def _cc_part(directory_owners): |
| 381 cc_part = [] |
| 382 for owner_tuple in sorted(directory_owners): |
| 383 cc_part.extend('--cc=' + owner for owner in owner_tuple) |
| 384 return cc_part |
| 378 | 385 |
| 379 def get_directory_owners(self): | 386 def get_directory_owners(self): |
| 380 """Returns a mapping of email addresses to owners of changed tests.""" | 387 """Returns a mapping of email addresses to owners of changed tests.""" |
| 381 _log.info('Gathering directory owners emails to CC.') | 388 _log.info('Gathering directory owners emails to CC.') |
| 382 changed_files = self.host.git().changed_files() | 389 changed_files = self.host.git().changed_files() |
| 383 extractor = DirectoryOwnersExtractor(self.fs) | 390 extractor = DirectoryOwnersExtractor(self.fs) |
| 384 extractor.read_owner_map() | 391 extractor.read_owner_map() |
| 385 return extractor.list_owners(changed_files) | 392 return extractor.list_owners(changed_files) |
| 386 | 393 |
| 387 def _cl_description(self, directory_owners): | 394 def _cl_description(self, directory_owners): |
| (...skipping 77 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.""" | 472 """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']) | 473 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) |
| 467 renamed_tests = {} | 474 renamed_tests = {} |
| 468 for line in out.splitlines(): | 475 for line in out.splitlines(): |
| 469 _, source_path, dest_path = line.split() | 476 _, source_path, dest_path = line.split() |
| 470 source_test = self.finder.layout_test_name(source_path) | 477 source_test = self.finder.layout_test_name(source_path) |
| 471 dest_test = self.finder.layout_test_name(dest_path) | 478 dest_test = self.finder.layout_test_name(dest_path) |
| 472 if source_test and dest_test: | 479 if source_test and dest_test: |
| 473 renamed_tests[source_test] = dest_test | 480 renamed_tests[source_test] = dest_test |
| 474 return renamed_tests | 481 return renamed_tests |
| OLD | NEW |