OLD | NEW |
1 # Copyright (c) 2010 Google Inc. All rights reserved. | 1 # Copyright (c) 2010 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 _log.error(line) | 487 _log.error(line) |
488 | 488 |
489 files_to_add, files_to_delete, lines_to_remove = self._serial_commands(c
ommand_results) | 489 files_to_add, files_to_delete, lines_to_remove = self._serial_commands(c
ommand_results) |
490 if files_to_delete: | 490 if files_to_delete: |
491 self._tool.scm().delete_list(files_to_delete) | 491 self._tool.scm().delete_list(files_to_delete) |
492 if files_to_add: | 492 if files_to_add: |
493 self._tool.scm().add_list(files_to_add) | 493 self._tool.scm().add_list(files_to_add) |
494 return lines_to_remove | 494 return lines_to_remove |
495 | 495 |
496 def _rebaseline(self, options, test_prefix_list): | 496 def _rebaseline(self, options, test_prefix_list): |
| 497 """Downloads new baselines in parallel, then updates expectations files |
| 498 and optimizes baselines. |
| 499 |
| 500 Args: |
| 501 options: An object with the options passed to the current command. |
| 502 test_prefix_list: A map of test names to builder names to baseline |
| 503 suffixes to rebaseline. For example: |
| 504 { |
| 505 "some/test.html": {"builder-1": ["txt"], "builder-2": ["txt"
]}, |
| 506 "some/other.html": {"builder-1": ["txt"]} |
| 507 } |
| 508 This would mean that new text baselines should be downloaded for |
| 509 "some/test.html" on both builder-1 and builder-2, and new text |
| 510 baselines should be downloaded for "some/other.html" but only |
| 511 from builder-1. |
| 512 """ |
497 for test, builders_to_check in sorted(test_prefix_list.items()): | 513 for test, builders_to_check in sorted(test_prefix_list.items()): |
498 _log.info("Rebaselining %s" % test) | 514 _log.info("Rebaselining %s" % test) |
499 for builder, suffixes in sorted(builders_to_check.items()): | 515 for builder, suffixes in sorted(builders_to_check.items()): |
500 _log.debug(" %s: %s" % (builder, ",".join(suffixes))) | 516 _log.debug(" %s: %s" % (builder, ",".join(suffixes))) |
501 | 517 |
502 copy_baseline_commands, rebaseline_commands, extra_lines_to_remove = sel
f._rebaseline_commands(test_prefix_list, options) | 518 copy_baseline_commands, rebaseline_commands, extra_lines_to_remove = sel
f._rebaseline_commands(test_prefix_list, options) |
503 lines_to_remove = {} | 519 lines_to_remove = {} |
504 | 520 |
505 self._run_in_parallel_and_update_scm(copy_baseline_commands) | 521 self._run_in_parallel_and_update_scm(copy_baseline_commands) |
506 lines_to_remove = self._run_in_parallel_and_update_scm(rebaseline_comman
ds) | 522 lines_to_remove = self._run_in_parallel_and_update_scm(rebaseline_comman
ds) |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 issue_already_closed = tool.executive.run_command( | 917 issue_already_closed = tool.executive.run_command( |
902 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline
_branch_name], | 918 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline
_branch_name], |
903 return_exit_code=True) | 919 return_exit_code=True) |
904 if not issue_already_closed: | 920 if not issue_already_closed: |
905 self._run_git_cl_command(options, ['set_close']) | 921 self._run_git_cl_command(options, ['set_close']) |
906 | 922 |
907 tool.scm().ensure_cleanly_tracking_remote_master() | 923 tool.scm().ensure_cleanly_tracking_remote_master() |
908 if old_branch_name_or_ref: | 924 if old_branch_name_or_ref: |
909 tool.scm().checkout_branch(old_branch_name_or_ref) | 925 tool.scm().checkout_branch(old_branch_name_or_ref) |
910 tool.scm().delete_branch(rebaseline_branch_name) | 926 tool.scm().delete_branch(rebaseline_branch_name) |
OLD | NEW |