Reviewers: Jakob,

Message:
PTAL.

Description:
Only presubmit check files in git repo for copyright note etc. (if using git).


Please review this at http://codereview.chromium.org/7792068/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M tools/presubmit.py


Index: tools/presubmit.py
diff --git a/tools/presubmit.py b/tools/presubmit.py
index 7b4719f4762725a0771bae77eddac28a031a456d..8e1f7b85e99d49cbc2871110ff8abb4c96d474f3 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,22 @@ 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 not os.path.exists(path+'/.git'):
+      return super(SourceProcessor, self).FindFilesIn(path)
+    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))
+    return result
+
   def IsRelevant(self, name):
     for ext in SourceProcessor.RELEVANT_EXTENSIONS:
       if name.endswith(ext):


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to