| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 """A command to fetch new baselines from try jobs for a Rietveld issue. | 5 """A command to fetch new baselines from try jobs for a Rietveld issue. |
| 6 | 6 |
| 7 This command interacts with the Rietveld API to get information about try jobs | 7 This command interacts with the Rietveld API to get information about try jobs |
| 8 with layout test results. | 8 with layout test results. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 test_prefix_list = {} | 70 test_prefix_list = {} |
| 71 for test in args: | 71 for test in args: |
| 72 test_prefix_list[test] = {b: BASELINE_SUFFIX_LIST for b in build
s} | 72 test_prefix_list[test] = {b: BASELINE_SUFFIX_LIST for b in build
s} |
| 73 else: | 73 else: |
| 74 test_prefix_list = self._test_prefix_list( | 74 test_prefix_list = self._test_prefix_list( |
| 75 issue_number, only_changed_tests=options.only_changed_tests) | 75 issue_number, only_changed_tests=options.only_changed_tests) |
| 76 self._log_test_prefix_list(test_prefix_list) | 76 self._log_test_prefix_list(test_prefix_list) |
| 77 | 77 |
| 78 if options.dry_run: | 78 if options.dry_run: |
| 79 return | 79 return |
| 80 self._rebaseline(options, test_prefix_list, update_scm=False) | 80 self._rebaseline(options, test_prefix_list) |
| 81 | 81 |
| 82 def _get_issue_number(self, options): | 82 def _get_issue_number(self, options): |
| 83 """Gets the Rietveld CL number from either |options| or from the current
local branch.""" | 83 """Gets the Rietveld CL number from either |options| or from the current
local branch.""" |
| 84 if options.issue: | 84 if options.issue: |
| 85 return options.issue | 85 return options.issue |
| 86 issue_number = self.git_cl().get_issue_number() | 86 issue_number = self.git_cl().get_issue_number() |
| 87 _log.debug('Issue number for current branch: %s', issue_number) | 87 _log.debug('Issue number for current branch: %s', issue_number) |
| 88 if not issue_number.isdigit(): | 88 if not issue_number.isdigit(): |
| 89 _log.error('No issue number given and no issue for current branch. T
his tool requires a CL\n' | 89 _log.error('No issue number given and no issue for current branch. T
his tool requires a CL\n' |
| 90 'to operate on; please run `git cl upload` on this branch
first, or use the --issue\n' | 90 'to operate on; please run `git cl upload` on this branch
first, or use the --issue\n' |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 @staticmethod | 170 @staticmethod |
| 171 def _log_test_prefix_list(test_prefix_list): | 171 def _log_test_prefix_list(test_prefix_list): |
| 172 """Logs the tests to download new baselines for.""" | 172 """Logs the tests to download new baselines for.""" |
| 173 if not test_prefix_list: | 173 if not test_prefix_list: |
| 174 _log.info('No tests to rebaseline; exiting.') | 174 _log.info('No tests to rebaseline; exiting.') |
| 175 return | 175 return |
| 176 _log.info('Tests to rebaseline:') | 176 _log.info('Tests to rebaseline:') |
| 177 for test, builds in test_prefix_list.iteritems(): | 177 for test, builds in test_prefix_list.iteritems(): |
| 178 builds_str = ', '.join(sorted('%s (%s)' % (b.builder_name, b.build_n
umber) for b in builds)) | 178 builds_str = ', '.join(sorted('%s (%s)' % (b.builder_name, b.build_n
umber) for b in builds)) |
| 179 _log.info(' %s: %s', test, builds_str) | 179 _log.info(' %s: %s', test, builds_str) |
| OLD | NEW |