gclient: add gitmodules command to update/add submodules based on DEPS.

Bug: 1421776
Change-Id: Id1ac48c4b65c17027fa24d0ba350a1a7f2eec64d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4665787
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
Joanna Wang
2023-08-09 01:25:15 +00:00
committed by LUCI CQ
parent d6f65bfa32
commit 3ab2f21289
3 changed files with 168 additions and 1 deletions

View File

@@ -212,7 +212,7 @@ class FakeReposBase(object):
class FakeRepos(FakeReposBase):
"""Implements populateGit()."""
NB_GIT_REPOS = 18
NB_GIT_REPOS = 20
def populateGit(self):
# Testing:
@@ -759,6 +759,73 @@ hooks = [{
'git/repo_18@2\n'
})
# a relative path repo
self._commit_git(
'repo_19', {
'DEPS': """
git_dependencies = "SUBMODULES"
use_relative_paths = True
vars = {
'foo_checkout': True,
}
deps = {
"some_repo": {
"url": '/repo_2@%(hash_2)s',
"condition": "not foo_checkout",
},
"chicken/dickens": {
"url": '/repo_3@%(hash_3)s',
},
"weird/deps": {
"url": '/repo_1'
},
"bar": {
"packages": [{
"package": "lemur",
"version": "version:1234",
}],
"dep_type": "cipd",
},
}""" % {
'hash_2': self.git_hashes['repo_2'][1][0],
'hash_3': self.git_hashes['repo_3'][1][0],
},
})
# a non-relative_path repo
self._commit_git(
'repo_20', {
'DEPS': """
git_dependencies = "SUBMODULES"
vars = {
'foo_checkout': True,
}
deps = {
"foo/some_repo": {
"url": '/repo_2@%(hash_2)s',
"condition": "not foo_checkout",
},
"foo/chicken/dickens": {
"url": '/repo_3@%(hash_3)s',
},
"foo/weird/deps": {
"url": '/repo_1'
},
"foo/bar": {
"packages": [{
"package": "lemur",
"version": "version:1234",
}],
"dep_type": "cipd",
},
}""" % {
'hash_2': self.git_hashes['repo_2'][1][0],
'hash_3': self.git_hashes['repo_3'][1][0],
},
})
class FakeRepoSkiaDEPS(FakeReposBase):
"""Simulates the Skia DEPS transition in Chrome."""