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): ...@@ -622,7 +622,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
parent=self, parent=self,
name=name, name=name,
url=url, url=url,
managed=None, managed=True,
custom_deps=None, custom_deps=None,
custom_vars=self.custom_vars, custom_vars=self.custom_vars,
custom_hooks=None, custom_hooks=None,
...@@ -855,6 +855,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): ...@@ -855,6 +855,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
file_list = [] if not options.nohooks else None file_list = [] if not options.nohooks else None
revision_override = revision_overrides.pop( revision_override = revision_overrides.pop(
self.FuzzyMatchUrl(revision_overrides), None) self.FuzzyMatchUrl(revision_overrides), None)
if not revision_override and not self.managed:
revision_override = 'unmanaged'
if run_scm and self.url: if run_scm and self.url:
# Create a shallow copy to mutate revision. # Create a shallow copy to mutate revision.
options = copy.copy(options) options = copy.copy(options)
...@@ -1477,10 +1479,6 @@ it or fix the checkout. ...@@ -1477,10 +1479,6 @@ it or fix the checkout.
revision_overrides = {} revision_overrides = {}
if self._options.head: if self._options.head:
return revision_overrides 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: if not self._options.revisions:
return revision_overrides return revision_overrides
solutions_names = [s.name for s in self.dependencies] solutions_names = [s.name for s in self.dependencies]
......
...@@ -530,6 +530,26 @@ class GClientSmokeGIT(GClientSmokeBase): ...@@ -530,6 +530,26 @@ class GClientSmokeGIT(GClientSmokeBase):
['sync', '-v', '-v', '-v', '--revision', 'refs/changes/1212']) ['sync', '-v', '-v', '-v', '--revision', 'refs/changes/1212'])
self.assertEquals(0, rc) 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): def testSyncUrl(self):
if not self.enabled: if not self.enabled:
return 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