mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Add ListSubmodules helper for presubmits.
We need this for this presubmit otherwise we cannot remove git deps from DEPS: http://shortn/_P7Xkt33SRx We will also be able to reuse this and replace: http://shortn/_WYBIUC9pa4 Bug: 1475770 Change-Id: I4cea689d130df77c344d82d4d8f9db02d42cd847 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5209098 Commit-Queue: Joanna Wang <jojwang@chromium.org> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
11
scm.py
11
scm.py
@@ -455,6 +455,17 @@ class GIT(object):
|
||||
return VERSIONED_SUBMODULE
|
||||
return VERSIONED_DIR
|
||||
|
||||
@staticmethod
|
||||
def ListSubmodules(repo_root):
|
||||
# type: (str) -> Collection[str]
|
||||
"""Returns the list of submodule paths for the given repo."""
|
||||
if not os.path.exists(os.path.join(repo_root, '.gitmodules')):
|
||||
return []
|
||||
config_output = GIT.Capture(
|
||||
['git', 'config', '--file', '.gitmodules', '--get-regexp', 'path'],
|
||||
cwd=repo_root)
|
||||
return [line.split()[-1] for line in config_output.splitlines()]
|
||||
|
||||
@staticmethod
|
||||
def CleanupDir(cwd, relative_dir):
|
||||
"""Cleans up untracked file inside |relative_dir|."""
|
||||
|
||||
Reference in New Issue
Block a user