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

Unified Diff: tools/presubmit.py

Issue 7792068: Only presubmit check files in git repo for copyright note etc. (if using git). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Taking return code into account. Created 9 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/presubmit.py
diff --git a/tools/presubmit.py b/tools/presubmit.py
index 7b4719f4762725a0771bae77eddac28a031a456d..50d2620162f4cf5a8e352a788b61ee2c72402a82 100755
--- a/tools/presubmit.py
+++ b/tools/presubmit.py
@@ -42,6 +42,7 @@ import pickle
import re
import sys
import subprocess
+from subprocess import PIPE
# Disabled LINT rules and reason.
# build/include_what_you_use: Started giving false positives for variables
@@ -236,6 +237,23 @@ class SourceProcessor(SourceFileProcessor):
RELEVANT_EXTENSIONS = ['.js', '.cc', '.h', '.py', '.c', 'SConscript',
'SConstruct', '.status', '.gyp', '.gypi']
+ # Overwriting the one in the parent class.
+ def FindFilesIn(self, path):
+ if os.path.exists(path+'/.git'):
+ output = subprocess.Popen('git ls-files --full-name',
+ stdout=PIPE, cwd=path, shell=True)
+ result = []
+ for file in output.stdout.read().split():
+ for dir_part in os.path.dirname(file).split(os.sep):
+ if self.IgnoreDir(dir_part):
+ break
+ else:
+ if self.IsRelevant(file) and not self.IgnoreFile(file):
+ result.append(join(path, file))
+ if output.wait() == 0:
+ return result
+ return super(SourceProcessor, self).FindFilesIn(path)
+
def IsRelevant(self, name):
for ext in SourceProcessor.RELEVANT_EXTENSIONS:
if name.endswith(ext):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698