Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Unified Diff: presubmit_support.py

Issue 6932060: Remove presubmit warning for long lines in .grd files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « presubmit_canned_checks.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_support.py
===================================================================
--- presubmit_support.py (revision 84701)
+++ presubmit_support.py (working copy)
@@ -314,7 +314,8 @@
if depot_path:
return depot_path
- def AffectedFiles(self, include_dirs=False, include_deletes=True):
+ def AffectedFiles(self, include_dirs=False, include_deletes=True,
+ file_filter=None):
"""Same as input_api.change.AffectedFiles() except only lists files
(and optionally directories) in the same directory as the current presubmit
script, or subdirectories thereof.
@@ -322,9 +323,10 @@
dir_with_slash = normpath("%s/" % self.PresubmitLocalPath())
if len(dir_with_slash) == 1:
dir_with_slash = ''
+
return filter(
lambda x: normpath(x.AbsoluteLocalPath()).startswith(dir_with_slash),
- self.change.AffectedFiles(include_dirs, include_deletes))
+ self.change.AffectedFiles(include_dirs, include_deletes, file_filter))
def LocalPaths(self, include_dirs=False):
"""Returns local paths of input_api.AffectedFiles()."""
@@ -715,12 +717,14 @@
raise AttributeError(self, attr)
return self.tags.get(attr)
- def AffectedFiles(self, include_dirs=False, include_deletes=True):
+ def AffectedFiles(self, include_dirs=False, include_deletes=True,
+ file_filter=None):
"""Returns a list of AffectedFile instances for all files in the change.
Args:
include_deletes: If false, deleted files will be filtered out.
include_dirs: True to include directories in the list
+ file_filter: An additional filter to apply.
Returns:
[AffectedFile(path, action), AffectedFile(path, action)]
@@ -730,6 +734,8 @@
else:
affected = filter(lambda x: not x.IsDirectory(), self._affected_files)
+ affected = filter(file_filter, affected)
+
if include_deletes:
return affected
else:
« no previous file with comments | « presubmit_canned_checks.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698