Commit 5be9df2e authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

[blinkpy] Drop the similarity index for rename detection to 90%

for wpt-expectations-updater (used by wpt-importer)

100% was too strict, as renaming/moving a file would usually require
changing the paths in the file. 90% *should* be enough for the most
basic cases (e.g. reference, resources), while still conservative enough
not to cause confusion caused by shared boilerplate between a deleted
test and a newly added test.

Also removed an unnecessary "-M" flag for deletion detection.

Drive-by: some stylistic fixes (by pylint and `git cl format`)

Bug: 1141061
Change-Id: I9196d0739eb3e93b63dbb29d6b271c07df5b7357
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2500722Reviewed-by: default avatarRakib Hasan <rmhasan@google.com>
Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821229}
parent b559c55f
...@@ -86,8 +86,8 @@ class WPTExpectationsUpdater(object): ...@@ -86,8 +86,8 @@ class WPTExpectationsUpdater(object):
log_level = logging.DEBUG if self.options.verbose else logging.INFO log_level = logging.DEBUG if self.options.verbose else logging.INFO
configure_logging(logging_level=log_level, include_time=True) configure_logging(logging_level=log_level, include_time=True)
if not(self.options.android_product or if not (self.options.android_product
self.options.update_android_expectations_only): or self.options.update_android_expectations_only):
assert not self.options.include_unexpected_pass, ( assert not self.options.include_unexpected_pass, (
'Command line argument --include-unexpected-pass is not ' 'Command line argument --include-unexpected-pass is not '
'supported in desktop mode.') 'supported in desktop mode.')
...@@ -293,9 +293,9 @@ class WPTExpectationsUpdater(object): ...@@ -293,9 +293,9 @@ class WPTExpectationsUpdater(object):
""" """
test_dict = {} test_dict = {}
configs = self.get_builder_configs(build, web_test_results) configs = self.get_builder_configs(build, web_test_results)
_log.debug('Getting failing results dictionary' _log.debug(
' for %s step in latest %s build' % ( 'Getting failing results dictionary for %s step in latest %s build',
web_test_results.step_name(), build.builder_name)) web_test_results.step_name(), build.builder_name)
if len(configs) > 1: if len(configs) > 1:
raise ScriptError('More than one configs were produced for' raise ScriptError('More than one configs were produced for'
...@@ -726,9 +726,8 @@ class WPTExpectationsUpdater(object): ...@@ -726,9 +726,8 @@ class WPTExpectationsUpdater(object):
renamed_files = self._list_renamed_files() renamed_files = self._list_renamed_files()
for path in self._test_expectations.expectations_dict: for path in self._test_expectations.expectations_dict:
_log.info( _log.info('Updating %s for any removed or renamed tests.',
'Updating %s for any removed or renamed tests.' % self.host.filesystem.basename(path))
self.host.filesystem.basename(path))
self._clean_single_test_expectations_file( self._clean_single_test_expectations_file(
path, deleted_files, renamed_files) path, deleted_files, renamed_files)
self._test_expectations.commit_changes() self._test_expectations.commit_changes()
...@@ -737,7 +736,7 @@ class WPTExpectationsUpdater(object): ...@@ -737,7 +736,7 @@ class WPTExpectationsUpdater(object):
# TODO(robertma): Improve Git.changed_files so that we can use # TODO(robertma): Improve Git.changed_files so that we can use
# it here. # it here.
paths = self.git.run( paths = self.git.run(
['diff', 'origin/master', '-M100%', '--diff-filter=D', ['diff', 'origin/master', '--diff-filter=D',
'--name-only']).splitlines() '--name-only']).splitlines()
deleted_files = [] deleted_files = []
for p in paths: for p in paths:
...@@ -754,9 +753,10 @@ class WPTExpectationsUpdater(object): ...@@ -754,9 +753,10 @@ class WPTExpectationsUpdater(object):
Returns a dictionary mapping source name to destination name. Returns a dictionary mapping source name to destination name.
""" """
out = self.git.run( out = self.git.run([
['diff', 'origin/master', '-M100%', '--diff-filter=R', 'diff', 'origin/master', '-M90%', '--diff-filter=R',
'--name-status']) '--name-status'
])
renamed_tests = {} renamed_tests = {}
for line in out.splitlines(): for line in out.splitlines():
_, source_path, dest_path = line.split() _, source_path, dest_path = line.split()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment