Commit 5d6cde39 authored by Edward Lesmes's avatar Edward Lesmes Committed by Commit Bot

gclient: Don't parse DEPS files that we won't recurse into.

Bug: 830306
Change-Id: I419f16583dc2bf4bd2a66a41eb73fff4802686a8
Reviewed-on: https://chromium-review.googlesource.com/1011391
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
parent 7662307e
......@@ -1014,13 +1014,14 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
while file_list[i].startswith(('\\', '/')):
file_list[i] = file_list[i][1:]
# Always parse the DEPS file.
self.ParseDepsFile(expand_vars=(command != 'flatten'))
if self.recursion_limit:
self.ParseDepsFile(expand_vars=(command != 'flatten'))
self._run_is_done(file_list or [], parsed_url)
if command in ('update', 'revert') and not options.noprehooks:
self.RunPreDepsHooks()
if self.recursion_limit:
if command in ('update', 'revert') and not options.noprehooks:
self.RunPreDepsHooks()
# Parse the dependencies of this dependency.
for s in self.dependencies:
if s.should_process:
......
......@@ -362,6 +362,35 @@ class GClientSmokeGIT(GClientSmokeBase):
])
self.assertTree(tree)
def testSyncJsonOutput(self):
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
output_json = os.path.join(self.root_dir, 'output.json')
self.gclient(['sync', '--deps', 'mac', '--output-json', output_json])
with open(output_json) as f:
output_json = json.load(f)
out = {
'solutions': {
'src/': {
'scm': 'git',
'url': self.git_base + 'repo_1',
'revision': self.githash('repo_1', 2),
},
'src/repo2/': {
'scm': 'git',
'url':
self.git_base + 'repo_2@' + self.githash('repo_2', 1)[:7],
'revision': self.githash('repo_2', 1),
},
'src/repo2/repo_renamed/': {
'scm': 'git',
'url': '/repo_3',
'revision': self.githash('repo_3', 2),
},
},
}
self.assertEqual(out, output_json)
def testSyncIgnoredSolutionName(self):
"""TODO(maruel): This will become an error soon."""
if not self.enabled:
......@@ -786,10 +815,9 @@ class GClientSmokeGIT(GClientSmokeBase):
'name': 'src',
'deps_file': 'DEPS',
'custom_deps': {
'foo/bar': None,
'src/repo2': '%srepo_2@%s' % (
self.git_base, self.githash('repo_2', 1)),
u'src/repo2/repo_renamed': '%srepo_3@%s' % (
'src/repo2/repo_renamed': '%srepo_3@%s' % (
self.git_base, self.githash('repo_3', 2)),
},
}]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment