mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Add AffectedSubmodules() to presubmit change.
+ Change scm GetAllFiles back to returning all files + should be safe to do since it's only used by presubmit code + add ignore_submodules option to CaptureStatus + It's used by other parts of depot_tools code + Add AffectedSubmodules to return submodules only + AffectedFiles still only returns non-submodule files. Bug: 1475770 Change-Id: I457ad96099fb20eff4cc1a4fc84f59e7ae707abe Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5216005 Auto-Submit: Joanna Wang <jojwang@chromium.org> Commit-Queue: Joanna Wang <jojwang@chromium.org> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
19
scm.py
19
scm.py
@@ -127,7 +127,10 @@ class GIT(object):
|
||||
return output.strip() if strip_out else output
|
||||
|
||||
@staticmethod
|
||||
def CaptureStatus(cwd, upstream_branch, end_commit=None):
|
||||
def CaptureStatus(cwd,
|
||||
upstream_branch,
|
||||
end_commit=None,
|
||||
ignore_submodules=True):
|
||||
# type: (str, str, Optional[str]) -> Sequence[Tuple[str, str]]
|
||||
"""Returns git status.
|
||||
|
||||
@@ -138,11 +141,15 @@ class GIT(object):
|
||||
upstream_branch = GIT.GetUpstreamBranch(cwd)
|
||||
if upstream_branch is None:
|
||||
raise gclient_utils.Error('Cannot determine upstream branch')
|
||||
|
||||
command = [
|
||||
'-c', 'core.quotePath=false', 'diff', '--name-status',
|
||||
'--no-renames', '--ignore-submodules=all', '-r',
|
||||
'%s...%s' % (upstream_branch, end_commit)
|
||||
'--no-renames'
|
||||
]
|
||||
if ignore_submodules:
|
||||
command.append('--ignore-submodules=all')
|
||||
command.extend(['-r', '%s...%s' % (upstream_branch, end_commit)])
|
||||
|
||||
status = GIT.Capture(command, cwd)
|
||||
results = []
|
||||
if status:
|
||||
@@ -398,10 +405,8 @@ class GIT(object):
|
||||
@staticmethod
|
||||
def GetAllFiles(cwd):
|
||||
"""Returns the list of all files under revision control."""
|
||||
command = ['-c', 'core.quotePath=false', 'ls-files', '-s', '--', '.']
|
||||
files = GIT.Capture(command, cwd=cwd).splitlines(False)
|
||||
# return only files
|
||||
return [f.split(maxsplit=3)[-1] for f in files if f.startswith('100')]
|
||||
command = ['-c', 'core.quotePath=false', 'ls-files', '--', '.']
|
||||
return GIT.Capture(command, cwd=cwd).splitlines(False)
|
||||
|
||||
@staticmethod
|
||||
def GetSubmoduleCommits(cwd, submodules):
|
||||
|
||||
Reference in New Issue
Block a user