Handle mixed slash types in FilterSourceFile

The files_to_skip lists in chrome/android/java/src/PRESUBMIT.py were
not working on Windows because they didn't use the verbose [\\\/]
construct for path separators. Fixing this in FilterSourceFile means
that multiple failures may be fixed simultaneously. The only failures
that this is known to fix are a set of AlertDialog.Builder errors that
were showing up only on Windows.

This addresses the issues that were going to be incorrectly fixed in
crrev.com/c/3606128 (now abandoned).

Bug: 1309977
Change-Id: I7a10483448e00df55e2cbf8bff8bad7a5d8db124
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3609117
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
changes/17/3609117/3
Bruce Dawson 3 years ago committed by LUCI CQ
parent 9856ff0e46
commit a3a014e9d5

@ -773,6 +773,11 @@ class InputApi(object):
for item in items:
if self.re.match(item, local_path):
return True
# Handle the cases where the files regex only handles /, but the local
# path uses \.
if self.is_windows and self.re.match(item, local_path.replace(
'\\', '/')):
return True
return False
return (Find(affected_file, files_to_check) and
not Find(affected_file, files_to_skip))

Loading…
Cancel
Save