Commit 0409c8d6 authored by yangguo@chromium.org's avatar yangguo@chromium.org

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

Review URL: http://codereview.chromium.org/7792068

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9113 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 913f444c
...@@ -42,6 +42,7 @@ import pickle ...@@ -42,6 +42,7 @@ import pickle
import re import re
import sys import sys
import subprocess import subprocess
from subprocess import PIPE
# Disabled LINT rules and reason. # Disabled LINT rules and reason.
# build/include_what_you_use: Started giving false positives for variables # build/include_what_you_use: Started giving false positives for variables
...@@ -236,6 +237,23 @@ class SourceProcessor(SourceFileProcessor): ...@@ -236,6 +237,23 @@ class SourceProcessor(SourceFileProcessor):
RELEVANT_EXTENSIONS = ['.js', '.cc', '.h', '.py', '.c', 'SConscript', RELEVANT_EXTENSIONS = ['.js', '.cc', '.h', '.py', '.c', 'SConscript',
'SConstruct', '.status', '.gyp', '.gypi'] '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): def IsRelevant(self, name):
for ext in SourceProcessor.RELEVANT_EXTENSIONS: for ext in SourceProcessor.RELEVANT_EXTENSIONS:
if name.endswith(ext): if name.endswith(ext):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment