scm: Add GetAllFiles method.
Will be used by presubmit_support to run checks over all files on a repo.
Bug: 1042324
Change-Id: I872b4eb7f287f3a4b14d753cad73d0c5d7beb00c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2002961
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/scm.py b/scm.py
index a1699fb..a341113 100644
--- a/scm.py
+++ b/scm.py
@@ -322,6 +322,12 @@
return GIT.Capture(command, cwd=cwd).splitlines(False)
@staticmethod
+ def GetAllFiles(cwd):
+ """Returns the list of all files under revision control."""
+ command = ['-c', 'core.quotePath=false', 'ls-files', '--', '.']
+ return GIT.Capture(command, cwd=cwd).splitlines(False)
+
+ @staticmethod
def GetPatchName(cwd):
"""Constructs a name for this patch."""
short_sha = GIT.Capture(['rev-parse', '--short=4', 'HEAD'], cwd=cwd)