| 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 download new baselines for NeedsRebaseline tests. | 5 """A command to download new baselines for NeedsRebaseline tests. |
| 6 | 6 |
| 7 This command checks the list of tests with NeedsRebaseline expectations, | 7 This command checks the list of tests with NeedsRebaseline expectations, |
| 8 and downloads the latest baselines for those tests from the results archived | 8 and downloads the latest baselines for those tests from the results archived |
| 9 by the continuous builders. | 9 by the continuous builders. |
| 10 """ | 10 """ |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 blink_tree_status_url = 'http://chromium-status.appspot.com/status' | 195 blink_tree_status_url = 'http://chromium-status.appspot.com/status' |
| 196 status = urllib2.urlopen(blink_tree_status_url).read().lower() | 196 status = urllib2.urlopen(blink_tree_status_url).read().lower() |
| 197 if 'closed' in status or status == '0': | 197 if 'closed' in status or status == '0': |
| 198 return 'closed' | 198 return 'closed' |
| 199 elif 'open' in status or status == '1': | 199 elif 'open' in status or status == '1': |
| 200 return 'open' | 200 return 'open' |
| 201 return 'unknown' | 201 return 'unknown' |
| 202 | 202 |
| 203 def execute(self, options, args, tool): | 203 def execute(self, options, args, tool): |
| 204 self._tool = tool | 204 self._tool = tool |
| 205 if tool.git().executable_name == 'svn': | |
| 206 _log.error('Auto rebaseline only works with a git checkout.') | |
| 207 return | |
| 208 | 205 |
| 209 if not options.dry_run and tool.git().has_working_directory_changes(): | 206 if not options.dry_run and tool.git().has_working_directory_changes(): |
| 210 _log.error('Cannot proceed with working directory changes. Clean wor
king directory first.') | 207 _log.error('Cannot proceed with working directory changes. Clean wor
king directory first.') |
| 211 return | 208 return |
| 212 | 209 |
| 213 revision_data = self.bot_revision_data(tool.git()) | 210 revision_data = self.bot_revision_data(tool.git()) |
| 214 if not revision_data: | 211 if not revision_data: |
| 215 return | 212 return |
| 216 | 213 |
| 217 min_revision = int(min([item['revision'] for item in revision_data])) | 214 min_revision = int(min([item['revision'] for item in revision_data])) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 issue_already_closed = tool.executive.run_command( | 277 issue_already_closed = tool.executive.run_command( |
| 281 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline
_branch_name], | 278 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline
_branch_name], |
| 282 return_exit_code=True) | 279 return_exit_code=True) |
| 283 if not issue_already_closed: | 280 if not issue_already_closed: |
| 284 self._run_git_cl_command(options, ['set_close']) | 281 self._run_git_cl_command(options, ['set_close']) |
| 285 | 282 |
| 286 tool.git().ensure_cleanly_tracking_remote_master() | 283 tool.git().ensure_cleanly_tracking_remote_master() |
| 287 if old_branch_name_or_ref: | 284 if old_branch_name_or_ref: |
| 288 tool.git().checkout_branch(old_branch_name_or_ref) | 285 tool.git().checkout_branch(old_branch_name_or_ref) |
| 289 tool.git().delete_branch(rebaseline_branch_name) | 286 tool.git().delete_branch(rebaseline_branch_name) |
| OLD | NEW |