Bug 1497898 - Update the lint to the new gitignore API, r=ato
authorJames Graham <james@hoppipolla.co.uk>
Fri, 16 Nov 2018 18:48:32 +0000
changeset 446815 166466f3a5fe137e02a710012babe8a14756afee
parent 446814 215f0ae6129888a0865d151835a86aee34368156
child 446816 9d61715037440d58adf237622245bb847b9a898c
push id35052
push userapavel@mozilla.com
push dateSat, 17 Nov 2018 11:25:40 +0000
treeherdermozilla-central@efc1da42132b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1497898
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1497898 - Update the lint to the new gitignore API, r=ato Depends on D8224 Differential Revision: https://phabricator.services.mozilla.com/D8225
testing/web-platform/tests/tools/lint/lint.py
--- a/testing/web-platform/tests/tools/lint/lint.py
+++ b/testing/web-platform/tests/tools/lint/lint.py
@@ -11,16 +11,17 @@ import sys
 import tempfile
 
 from collections import defaultdict
 
 from . import fnmatch
 from .. import localpaths
 from ..gitignore.gitignore import PathFilter
 from ..wpt import testfiles
+from ..manifest.vcs import walk
 
 from manifest.sourcefile import SourceFile, js_meta_re, python_meta_re, space_chars, get_any_variants, get_default_any_variants
 from six import binary_type, iteritems, itervalues
 from six.moves import range
 from six.moves.urllib.parse import urlsplit, urljoin
 
 import logging
 
@@ -62,24 +63,21 @@ you could add the following line to the 
 %s: %s"""
 
 def all_filesystem_paths(repo_root, subdir=None):
     path_filter = PathFilter(repo_root, extras=[".git/"])
     if subdir:
         expanded_path = subdir
     else:
         expanded_path = repo_root
-    for dirpath, dirnames, filenames in os.walk(expanded_path):
-        for filename in filenames:
-            path = os.path.relpath(os.path.join(dirpath, filename), repo_root)
-            if path_filter(path):
-                yield path
-        dirnames[:] = [item for item in dirnames if
-                       path_filter(os.path.relpath(os.path.join(dirpath, item) + "/",
-                                                   repo_root)+"/")]
+    for dirpath, dirnames, filenames in path_filter(walk(expanded_path)):
+        for filename, _ in filenames:
+            path = os.path.join(dirpath, filename)
+            yield path
+
 
 def _all_files_equal(paths):
     """
     Checks all the paths are files that are byte-for-byte identical
 
     :param paths: the list of paths to compare
     :returns: True if they are all identical
     """