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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 baseline_directory = self._baseline_directory(builder_name) | 213 baseline_directory = self._baseline_directory(builder_name) |
214 | 214 |
215 source_baseline = "%s/%s" % (results_url, self._file_name_for_actual_res
ult(test_name, suffix)) | 215 source_baseline = "%s/%s" % (results_url, self._file_name_for_actual_res
ult(test_name, suffix)) |
216 target_baseline = self._tool.filesystem.join(baseline_directory, self._f
ile_name_for_expected_result(test_name, suffix)) | 216 target_baseline = self._tool.filesystem.join(baseline_directory, self._f
ile_name_for_expected_result(test_name, suffix)) |
217 | 217 |
218 _log.debug("Retrieving %s." % source_baseline) | 218 _log.debug("Retrieving %s." % source_baseline) |
219 self._save_baseline(self._tool.web.get_binary(source_baseline, convert_4
04_to_None=True), | 219 self._save_baseline(self._tool.web.get_binary(source_baseline, convert_4
04_to_None=True), |
220 target_baseline, baseline_directory, test_name, suff
ix) | 220 target_baseline, baseline_directory, test_name, suff
ix) |
221 | 221 |
222 def _rebaseline_test_and_update_expectations(self, options): | 222 def _rebaseline_test_and_update_expectations(self, options): |
| 223 self._baseline_suffix_list = options.suffixes.split(',') |
| 224 |
223 port = self._tool.port_factory.get_from_builder_name(options.builder) | 225 port = self._tool.port_factory.get_from_builder_name(options.builder) |
224 if (port.reference_files(options.test)): | 226 if port.reference_files(options.test): |
225 _log.warning("Cannot rebaseline reftest: %s", options.test) | 227 if 'png' in self._baseline_suffix_list: |
226 return | 228 _log.warning("Cannot rebaseline image result for reftest: %s", o
ptions.test) |
| 229 return |
| 230 assert self._baseline_suffix_list == ['txt'] |
227 | 231 |
228 if options.results_directory: | 232 if options.results_directory: |
229 results_url = 'file://' + options.results_directory | 233 results_url = 'file://' + options.results_directory |
230 else: | 234 else: |
231 results_url = self._results_url(options.builder) | 235 results_url = self._results_url(options.builder) |
232 self._baseline_suffix_list = options.suffixes.split(',') | |
233 | 236 |
234 for suffix in self._baseline_suffix_list: | 237 for suffix in self._baseline_suffix_list: |
235 self._rebaseline_test(options.builder, options.test, suffix, results
_url) | 238 self._rebaseline_test(options.builder, options.test, suffix, results
_url) |
236 self._scm_changes['remove-lines'].append({'builder': options.builder, 't
est': options.test}) | 239 self._scm_changes['remove-lines'].append({'builder': options.builder, 't
est': options.test}) |
237 | 240 |
238 def execute(self, options, args, tool): | 241 def execute(self, options, args, tool): |
239 self._rebaseline_test_and_update_expectations(options) | 242 self._rebaseline_test_and_update_expectations(options) |
240 print json.dumps(self._scm_changes) | 243 print json.dumps(self._scm_changes) |
241 | 244 |
242 | 245 |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 issue_already_closed = tool.executive.run_command( | 940 issue_already_closed = tool.executive.run_command( |
938 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline
_branch_name], | 941 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline
_branch_name], |
939 return_exit_code=True) | 942 return_exit_code=True) |
940 if not issue_already_closed: | 943 if not issue_already_closed: |
941 self._run_git_cl_command(options, ['set_close']) | 944 self._run_git_cl_command(options, ['set_close']) |
942 | 945 |
943 tool.scm().ensure_cleanly_tracking_remote_master() | 946 tool.scm().ensure_cleanly_tracking_remote_master() |
944 if old_branch_name_or_ref: | 947 if old_branch_name_or_ref: |
945 tool.scm().checkout_branch(old_branch_name_or_ref) | 948 tool.scm().checkout_branch(old_branch_name_or_ref) |
946 tool.scm().delete_branch(rebaseline_branch_name) | 949 tool.scm().delete_branch(rebaseline_branch_name) |
OLD | NEW |