Revision: 9113
Author:   [email protected]
Date:     Fri Sep  2 01:04:51 2011
Log: Only presubmit check files in git repo for copyright note etc. (if using git).

Review URL: http://codereview.chromium.org/7792068
http://code.google.com/p/v8/source/detail?r=9113

Modified:
 /branches/bleeding_edge/tools/presubmit.py

=======================================
--- /branches/bleeding_edge/tools/presubmit.py  Thu Sep  1 04:28:10 2011
+++ /branches/bleeding_edge/tools/presubmit.py  Fri Sep  2 01:04:51 2011
@@ -42,6 +42,7 @@
 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 @@
   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):

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

Reply via email to