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

Unified Diff: PRESUBMIT.py

Issue 20770002: Ignore +grit entries in DEPS files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | « no previous file | PRESUBMIT_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 6558685dfde007a779e0ba957dd0af47a0b97e2b..efb665acff959892a21214708d31d8b5c6902684 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -727,6 +727,26 @@ def _CheckNoAbbreviationInPngFileName(input_api, output_api):
return results
+def _DepsFilesToCheck(re, changed_lines):
+ """Helper method for _CheckAddedDepsHaveTargetApprovals. Returns
+ a set of DEPS entries that we should look up."""
+ results = set()
+
+ # This pattern grabs the path without basename in the first
+ # parentheses, and the basename (if present) in the second. It
+ # relies on the simple heuristic that if there is a basename it will
+ # be a header file ending in ".h".
+ pattern = re.compile(
+ r"""['"]\+([^'"]+?)(/[a-zA-Z0-9_]+\.h)?['"].*""")
+ for changed_line in changed_lines:
+ m = pattern.match(changed_line)
+ if m:
+ path = m.group(1)
+ if not (path.startswith('grit/') or path == 'grit'):
+ results.add('%s/DEPS' % m.group(1))
+ return results
+
+
def _CheckAddedDepsHaveTargetApprovals(input_api, output_api):
"""When a dependency prefixed with + is added to a DEPS file, we
want to make sure that the change is reviewed by an OWNER of the
@@ -743,20 +763,7 @@ def _CheckAddedDepsHaveTargetApprovals(input_api, output_api):
if not changed_lines:
return []
- virtual_depended_on_files = set()
- # This pattern grabs the path without basename in the first
- # parentheses, and the basename (if present) in the second. It
- # relies on the simple heuristic that if there is a basename it will
- # be a header file ending in ".h".
- pattern = input_api.re.compile(
- r"""['"]\+([^'"]+?)(/[a-zA-Z0-9_]+\.h)?['"].*""")
- for changed_line in changed_lines:
- m = pattern.match(changed_line)
- if m:
- path = m.group(1)
- if not path.startswith('grit/'):
- virtual_depended_on_files.add('%s/DEPS' % m.group(1))
-
+ virtual_depended_on_files = _DepsFilesToCheck(input_api.re, changed_lines)
if not virtual_depended_on_files:
return []
« no previous file with comments | « no previous file | PRESUBMIT_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698