Commit e4213704 authored by Edward Lemur's avatar Edward Lemur Committed by Commit Bot

gclient: Make gclient respect unmanaged dependencies when syncing.

gclient syncs unmanaged dependencies when '--revision' files are passed,
regardless of whether the dependency appears in the revision flags or not.

Bug: 853032
Change-Id: I66de0865e1103d92524f565f4392dae24a5648e1
Reviewed-on: https://chromium-review.googlesource.com/1105416Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
parent cf0324cd
......@@ -622,7 +622,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
parent=self,
name=name,
url=url,
managed=None,
managed=True,
custom_deps=None,
custom_vars=self.custom_vars,
custom_hooks=None,
......@@ -855,6 +855,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
file_list = [] if not options.nohooks else None
revision_override = revision_overrides.pop(
self.FuzzyMatchUrl(revision_overrides), None)
if not revision_override and not self.managed:
revision_override = 'unmanaged'
if run_scm and self.url:
# Create a shallow copy to mutate revision.
options = copy.copy(options)
......@@ -1477,10 +1479,6 @@ it or fix the checkout.
revision_overrides = {}
if self._options.head:
return revision_overrides
if not self._options.revisions:
for s in self.dependencies:
if not s.managed:
self._options.revisions.append('%s@unmanaged' % s.name)
if not self._options.revisions:
return revision_overrides
solutions_names = [s.name for s in self.dependencies]
......
......@@ -530,6 +530,26 @@ class GClientSmokeGIT(GClientSmokeBase):
['sync', '-v', '-v', '-v', '--revision', 'refs/changes/1212'])
self.assertEquals(0, rc)
def testSyncUnmanaged(self):
if not self.enabled:
return
self.gclient([
'config', '--spec',
'solutions=[{"name":"src", "url": "%s", "managed": False}]' % (
self.git_base + 'repo_5')])
self.gclient([
'sync', '--revision', 'src@' + self.githash('repo_5', 2)])
self.gclient([
'sync', '--revision', 'src/repo1@%s' % self.githash('repo_1', 1)])
# src is unmanaged, so gclient shouldn't have updated it. It should've
# stayed synced at @2
tree = self.mangle_git_tree(('repo_5@2', 'src'),
('repo_1@1', 'src/repo1'),
('repo_2@1', 'src/repo2'))
tree['src/git_pre_deps_hooked'] = 'git_pre_deps_hooked'
self.maxDiff = None
self.assertTree(tree)
def testSyncUrl(self):
if not self.enabled:
return
......
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