Index: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py |
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py |
index d7f2a01488872004258fc356cd4b70cbf8460b47..8131cd473a759b5424de0fad0d0ac2d50dbc24b5 100644 |
--- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py |
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py |
@@ -69,15 +69,15 @@ class AbstractRebaseliningCommand(AbstractDeclarativeCommand): |
# not overriding execute() - pylint: disable=W0223 |
no_optimize_option = optparse.make_option('--no-optimize', dest='optimize', action='store_false', default=True, |
- help=('Do not optimize/de-dup the expectations after rebaselining (default is to de-dup automatically). ' |
- 'You can use "webkit-patch optimize-baselines" to optimize separately.')) |
+ help=('Do not optimize/de-dup the expectations after rebaselining (default is to de-dup automatically). ' |
+ 'You can use "webkit-patch optimize-baselines" to optimize separately.')) |
platform_options = factory.platform_options(use_globs=True) |
results_directory_option = optparse.make_option("--results-directory", help="Local results directory to use") |
suffixes_option = optparse.make_option("--suffixes", default=','.join(BASELINE_SUFFIX_LIST), action="store", |
- help="Comma-separated-list of file types to rebaseline") |
+ help="Comma-separated-list of file types to rebaseline") |
def __init__(self, options=None): |
super(AbstractRebaseliningCommand, self).__init__(options=options) |
@@ -92,13 +92,14 @@ class AbstractRebaseliningCommand(AbstractDeclarativeCommand): |
class BaseInternalRebaselineCommand(AbstractRebaseliningCommand): |
+ |
def __init__(self): |
super(BaseInternalRebaselineCommand, self).__init__(options=[ |
self.results_directory_option, |
self.suffixes_option, |
optparse.make_option("--builder", help="Builder to pull new baselines from"), |
optparse.make_option("--test", help="Test to rebaseline"), |
- ]) |
+ ]) |
def _baseline_directory(self, builder_name): |
port = self._tool.port_factory.get_from_builder_name(builder_name) |
@@ -147,7 +148,8 @@ class CopyExistingBaselinesInternal(BaseInternalRebaselineCommand): |
def _copy_existing_baseline(self, builder_name, test_name, suffix): |
baseline_directory = self._baseline_directory(builder_name) |
- ports = [self._port_for_primary_baseline(baseline) for baseline in self._immediate_predecessors_in_fallback(baseline_directory)] |
+ ports = [self._port_for_primary_baseline(baseline) |
+ for baseline in self._immediate_predecessors_in_fallback(baseline_directory)] |
old_baselines = [] |
new_baselines = [] |
@@ -214,7 +216,8 @@ class RebaselineTest(BaseInternalRebaselineCommand): |
target_baseline = self._tool.filesystem.join(baseline_directory, self._file_name_for_expected_result(test_name, suffix)) |
_log.debug("Retrieving %s." % source_baseline) |
- self._save_baseline(self._tool.web.get_binary(source_baseline, convert_404_to_None=True), target_baseline, baseline_directory, test_name, suffix) |
+ self._save_baseline(self._tool.web.get_binary(source_baseline, convert_404_to_None=True), |
+ target_baseline, baseline_directory, test_name, suffix) |
def _rebaseline_test_and_update_expectations(self, options): |
port = self._tool.port_factory.get_from_builder_name(options.builder) |
@@ -246,8 +249,9 @@ class OptimizeBaselines(AbstractRebaseliningCommand): |
def __init__(self): |
super(OptimizeBaselines, self).__init__(options=[ |
self.suffixes_option, |
- optparse.make_option('--no-modify-scm', action='store_true', default=False, help='Dump SCM commands as JSON instead of '), |
- ] + self.platform_options) |
+ optparse.make_option('--no-modify-scm', action='store_true', default=False, |
+ help='Dump SCM commands as JSON instead of '), |
+ ] + self.platform_options) |
def _optimize_baseline(self, optimizer, test_name): |
files_to_delete = [] |
@@ -290,7 +294,7 @@ class AnalyzeBaselines(AbstractRebaseliningCommand): |
super(AnalyzeBaselines, self).__init__(options=[ |
self.suffixes_option, |
optparse.make_option('--missing', action='store_true', default=False, help='show missing baselines as well'), |
- ] + self.platform_options) |
+ ] + self.platform_options) |
self._optimizer_class = BaselineOptimizer # overridable for testing |
self._baseline_optimizer = None |
self._port = None |
@@ -352,7 +356,8 @@ class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand): |
def _run_webkit_patch(self, args, verbose): |
try: |
verbose_args = ['--verbose'] if verbose else [] |
- stderr = self._tool.executive.run_command([self._tool.path()] + verbose_args + args, cwd=self._tool.scm().checkout_root, return_stderr=True) |
+ stderr = self._tool.executive.run_command([self._tool.path()] + verbose_args + |
+ args, cwd=self._tool.scm().checkout_root, return_stderr=True) |
for line in stderr.splitlines(): |
_log.warning(line) |
except ScriptError: |
@@ -390,7 +395,8 @@ class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand): |
for test_prefix in test_prefix_list: |
for test in port.tests([test_prefix]): |
for builder in self._builders_to_fetch_from(test_prefix_list[test_prefix]): |
- actual_failures_suffixes = self._suffixes_for_actual_failures(test, builder, test_prefix_list[test_prefix][builder]) |
+ actual_failures_suffixes = self._suffixes_for_actual_failures( |
+ test, builder, test_prefix_list[test_prefix][builder]) |
if not actual_failures_suffixes: |
# If we're not going to rebaseline the test because it's passing on this |
# builder, we still want to remove the line from TestExpectations. |
@@ -405,8 +411,10 @@ class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand): |
cmd_line.extend(['--results-directory', options.results_directory]) |
if options.verbose: |
cmd_line.append('--verbose') |
- copy_baseline_commands.append(tuple([[self._tool.executable, path_to_webkit_patch, 'copy-existing-baselines-internal'] + cmd_line, cwd])) |
- rebaseline_commands.append(tuple([[self._tool.executable, path_to_webkit_patch, 'rebaseline-test-internal'] + cmd_line, cwd])) |
+ copy_baseline_commands.append( |
+ tuple([[self._tool.executable, path_to_webkit_patch, 'copy-existing-baselines-internal'] + cmd_line, cwd])) |
+ rebaseline_commands.append( |
+ tuple([[self._tool.executable, path_to_webkit_patch, 'rebaseline-test-internal'] + cmd_line, cwd])) |
return copy_baseline_commands, rebaseline_commands, lines_to_remove |
def _serial_commands(self, command_results): |
@@ -565,7 +573,7 @@ class RebaselineJson(AbstractParallelRebaselineCommand): |
super(RebaselineJson, self).__init__(options=[ |
self.no_optimize_option, |
self.results_directory_option, |
- ]) |
+ ]) |
def execute(self, options, args, tool): |
self._rebaseline(options, json.loads(sys.stdin.read())) |
@@ -579,7 +587,7 @@ class RebaselineExpectations(AbstractParallelRebaselineCommand): |
def __init__(self): |
super(RebaselineExpectations, self).__init__(options=[ |
self.no_optimize_option, |
- ] + self.platform_options) |
+ ] + self.platform_options) |
self._test_prefix_list = None |
def _tests_to_rebaseline(self, port): |
@@ -631,11 +639,13 @@ class Rebaseline(AbstractParallelRebaselineCommand): |
# FIXME: should we support the platform options in addition to (or instead of) --builders? |
self.suffixes_option, |
self.results_directory_option, |
- optparse.make_option("--builders", default=None, action="append", help="Comma-separated-list of builders to pull new baselines from (can also be provided multiple times)"), |
- ]) |
+ optparse.make_option("--builders", default=None, action="append", |
+ help="Comma-separated-list of builders to pull new baselines from (can also be provided multiple times)"), |
+ ]) |
def _builders_to_pull_from(self): |
- chosen_names = self._tool.user.prompt_with_list("Which builder to pull results from:", self._release_builders(), can_choose_multiple=True) |
+ chosen_names = self._tool.user.prompt_with_list( |
+ "Which builder to pull results from:", self._release_builders(), can_choose_multiple=True) |
return [self._builder_with_name(name) for name in chosen_names] |
def _builder_with_name(self, name): |
@@ -688,9 +698,9 @@ class AutoRebaseline(AbstractParallelRebaselineCommand): |
self.results_directory_option, |
optparse.make_option("--auth-refresh-token-json", help="Rietveld auth refresh JSON token."), |
optparse.make_option("--dry-run", action='store_true', default=False, |
- help='Run without creating a temporary branch, committing locally, or uploading/landing ' |
- 'changes to the remote repository.') |
- ]) |
+ help='Run without creating a temporary branch, committing locally, or uploading/landing ' |
+ 'changes to the remote repository.') |
+ ]) |
self._blame_regex = re.compile(r""" |
^(\S*) # Commit hash |
[^(]* \( # Whitespace and open parenthesis |
@@ -819,7 +829,8 @@ class AutoRebaseline(AbstractParallelRebaselineCommand): |
subprocess_command.append('--auth-refresh-token-json') |
subprocess_command.append(options.auth_refresh_token_json) |
- process = self._tool.executive.popen(subprocess_command, stdout=self._tool.executive.PIPE, stderr=self._tool.executive.STDOUT) |
+ process = self._tool.executive.popen(subprocess_command, stdout=self._tool.executive.PIPE, |
+ stderr=self._tool.executive.STDOUT) |
last_output_time = time.time() |
# git cl sometimes completely hangs. Bail if we haven't gotten any output to stdout/stderr in a while. |
@@ -861,7 +872,8 @@ class AutoRebaseline(AbstractParallelRebaselineCommand): |
return |
min_revision = int(min([item["revision"] for item in revision_data])) |
- tests, revision, commit, author, bugs, has_any_needs_rebaseline_lines = self.tests_to_rebaseline(tool, min_revision, print_revisions=options.verbose) |
+ tests, revision, commit, author, bugs, has_any_needs_rebaseline_lines = self.tests_to_rebaseline( |
+ tool, min_revision, print_revisions=options.verbose) |
if options.verbose: |
_log.info("Min revision across all bots is %s." % min_revision) |
@@ -995,7 +1007,8 @@ class RebaselineOMatic(AbstractDeclarativeCommand): |
try: |
old_branch_name_or_ref = _get_branch_name_or_ref(self._tool) |
self._run_logged_command(['git', 'pull']) |
- rebaseline_command = [self._tool.filesystem.join(self._tool.scm().checkout_root, 'third_party', 'WebKit', 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline'] |
+ rebaseline_command = [self._tool.filesystem.join( |
+ self._tool.scm().checkout_root, 'third_party', 'WebKit', 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline'] |
if self._verbose: |
rebaseline_command.append('--verbose') |
self._run_logged_command(rebaseline_command) |