Chromium Code Reviews

Unified Diff: presubmit_support.py

Issue 281013002: Recursively find all tests in a repo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Add a list-files method Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « presubmit_canned_checks.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_support.py
diff --git a/presubmit_support.py b/presubmit_support.py
index 111db588aec44be481b084bc40db8aa819f9ed3a..7c23dc668dd78bf65e91f6262e476687412209e3 100755
--- a/presubmit_support.py
+++ b/presubmit_support.py
@@ -869,6 +869,10 @@ class Change(object):
raise AttributeError(self, attr)
return self.tags.get(attr)
+ def AllFiles(self, root=None):
+ """List all files under source control in the repo."""
+ raise NotImplementedError
M-A Ruel 2014/05/15 01:45:41 raise NotImplementedError() otherwise you raise th
agable 2014/05/15 01:57:42 Done.
+
def AffectedFiles(self, include_dirs=False, include_deletes=True,
file_filter=None):
"""Returns a list of AffectedFile instances for all files in the change.
@@ -965,11 +969,23 @@ class SvnChange(Change):
return [os.path.join(self.RepositoryRoot(), f[1])
for f in changelists[self.Name()]]
+ def AllFiles(self, root=None):
+ """List all files under source control in the repo."""
M-A Ruel 2014/05/15 01:45:41 Lists
agable 2014/05/15 01:56:31 PEP-257: The docstring is a phrase ending in a per
+ root = root or self.RepositoryRoot()
+ return subprocess.check_output(
+ ['svn', 'ls', '-R', '.'], cwd=root).splitlines()
+
class GitChange(Change):
_AFFECTED_FILES = GitAffectedFile
scm = 'git'
+ def AllFiles(self, root=None):
+ """List all files under source control in the repo."""
M-A Ruel 2014/05/15 01:45:41 Lists
agable 2014/05/15 01:56:31 See above.
+ root = root or self.RepositoryRoot()
+ return subprocess.check_output(
+ ['git', 'ls-files', '--', '.'], cwd=root).splitlines()
+
def ListRelevantPresubmitFiles(files, root):
"""Finds all presubmit files that apply to a given set of source files.
« no previous file with comments | « presubmit_canned_checks.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine