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

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: instantiate exception Created 6 years, 7 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 | « 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..e929e314d67d2244a7cc884100c25216c9e0a8a9 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()
+
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."""
+ 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."""
+ 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
This is Rietveld 408576698