Jelajahi Sumber

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>
Bruce Dawson 3 tahun lalu
induk
melakukan
a3a014e9d5
1 mengubah file dengan 5 tambahan dan 0 penghapusan
  1. 5 0
      presubmit_support.py

+ 5 - 0
presubmit_support.py

@@ -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))