Switch gclient config to default to unmanaged mode.

BUG=339055
R=hinoka@chromium.org

Review-Url: https://codereview.chromium.org/2099153003
changes/90/365990/1
agable 9 years ago committed by Commit bot
parent 808d7ea4f6
commit d4aedc811b

@ -224,7 +224,7 @@ class DependencySettings(GClientKeywords):
# 'managed' determines whether or not this dependency is synced/updated by # 'managed' determines whether or not this dependency is synced/updated by
# gclient after gclient checks it out initially. The difference between # gclient after gclient checks it out initially. The difference between
# 'managed' and 'should_process' is that the user specifies 'managed' via # 'managed' and 'should_process' is that the user specifies 'managed' via
# the --unmanaged command-line flag or a .gclient config, where # the --managed command-line flag or a .gclient config, where
# 'should_process' is dynamically set by gclient if it goes over its # 'should_process' is dynamically set by gclient if it goes over its
# recursion limit and controls gclient's behavior so it does not misbehave. # recursion limit and controls gclient's behavior so it does not misbehave.
self._managed = managed self._managed = managed
@ -1252,8 +1252,8 @@ The local checkout in %(checkout_path)s reports:
You should ensure that the URL listed in .gclient is correct and either change You should ensure that the URL listed in .gclient is correct and either change
it or fix the checkout. If you're managing your own git checkout in it or fix the checkout. If you're managing your own git checkout in
%(checkout_path)s but the URL in .gclient is for an svn repository, you probably %(checkout_path)s but the URL in .gclient is for an svn repository, you should
want to set 'managed': False in .gclient. set 'managed': False in .gclient.
''' % {'checkout_path': os.path.join(self.root_dir, dep.name), ''' % {'checkout_path': os.path.join(self.root_dir, dep.name),
'expected_url': dep.url, 'expected_url': dep.url,
'expected_scm': gclient_scm.GetScmName(dep.url), 'expected_scm': gclient_scm.GetScmName(dep.url),
@ -1300,7 +1300,7 @@ want to set 'managed': False in .gclient.
try: try:
deps_to_add.append(Dependency( deps_to_add.append(Dependency(
self, s['name'], s['url'], self, s['name'], s['url'],
s.get('managed', True), s.get('managed', False),
s.get('custom_deps', {}), s.get('custom_deps', {}),
s.get('custom_vars', {}), s.get('custom_vars', {}),
s.get('custom_hooks', []), s.get('custom_hooks', []),
@ -1426,7 +1426,7 @@ been automagically updated. The previous version is available at %s.old.
return client return client
def SetDefaultConfig(self, solution_name, deps_file, solution_url, def SetDefaultConfig(self, solution_name, deps_file, solution_url,
managed=True, cache_dir=None): managed=False, cache_dir=None):
self.SetConfig(self.DEFAULT_CLIENT_FILE_TEXT % { self.SetConfig(self.DEFAULT_CLIENT_FILE_TEXT % {
'solution_name': solution_name, 'solution_name': solution_name,
'solution_url': solution_url, 'solution_url': solution_url,
@ -1475,7 +1475,7 @@ been automagically updated. The previous version is available at %s.old.
revision_overrides = {} revision_overrides = {}
if not self._options.revisions: if not self._options.revisions:
for s in self.dependencies: for s in self.dependencies:
if not s.managed and not self._options.head: if not s.managed and not self._options.__dict__.get('head', False):
self._options.revisions.append('%s@unmanaged' % s.name) self._options.revisions.append('%s@unmanaged' % s.name)
if not self._options.revisions: if not self._options.revisions:
return revision_overrides return revision_overrides
@ -1861,11 +1861,13 @@ def CMDconfig(parser, args):
parser.add_option('--deps-file', default='DEPS', parser.add_option('--deps-file', default='DEPS',
help='overrides the default name for the DEPS file for the' help='overrides the default name for the DEPS file for the'
'main solutions and all sub-dependencies') 'main solutions and all sub-dependencies')
parser.add_option('--unmanaged', action='store_true', default=False, parser.add_option('--managed', action='store_true', default=False,
help='overrides the default behavior to make it possible ' help='overrides the default behavior to make it possible '
'to have the main solution untouched by gclient ' 'to have the main solution managed by gclient '
'(gclient will check out unmanaged dependencies but ' '(gclient will always auto-sync managed solutions '
'will never sync them)') ' rather than leaving them untouched)')
parser.add_option('--unmanaged', action='store_true', default=True,
help='This flag is a no-op; unmanaged is now the default.')
parser.add_option('--cache-dir', parser.add_option('--cache-dir',
help='(git only) Cache all git repos into this dir and do ' help='(git only) Cache all git repos into this dir and do '
'shared clones from the cache, instead of cloning ' 'shared clones from the cache, instead of cloning '
@ -1898,7 +1900,7 @@ def CMDconfig(parser, args):
deps_file = options.deps_file deps_file = options.deps_file
client.SetDefaultConfig(name, deps_file, base_url, client.SetDefaultConfig(name, deps_file, base_url,
managed=not options.unmanaged, managed=options.managed,
cache_dir=options.cache_dir) cache_dir=options.cache_dir)
client.SaveConfig() client.SaveConfig()
return 0 return 0

@ -209,7 +209,7 @@ class GClientSmoke(GClientSmokeBase):
' "name" : "src",\n' ' "name" : "src",\n'
' "url" : "%strunk/src",\n' ' "url" : "%strunk/src",\n'
' "deps_file" : "DEPS",\n' ' "deps_file" : "DEPS",\n'
' "managed" : True,\n' ' "managed" : False,\n'
' "custom_deps" : {},\n' ' "custom_deps" : {},\n'
' },\n' ' },\n'
']\n' ']\n'
@ -221,7 +221,7 @@ class GClientSmoke(GClientSmokeBase):
' "name" : "src",\n' ' "name" : "src",\n'
' "url" : "%srepo_1",\n' ' "url" : "%srepo_1",\n'
' "deps_file" : "DEPS",\n' ' "deps_file" : "DEPS",\n'
' "managed" : True,\n' ' "managed" : False,\n'
' "custom_deps" : {},\n' ' "custom_deps" : {},\n'
' },\n' ' },\n'
']\n' ']\n'
@ -233,7 +233,7 @@ class GClientSmoke(GClientSmokeBase):
' "name" : "foo",\n' ' "name" : "foo",\n'
' "url" : "foo",\n' ' "url" : "foo",\n'
' "deps_file" : "blah",\n' ' "deps_file" : "blah",\n'
' "managed" : True,\n' ' "managed" : False,\n'
' "custom_deps" : {},\n' ' "custom_deps" : {},\n'
' },\n' ' },\n'
']\n' ']\n'
@ -287,13 +287,14 @@ class GClientSmokeGIT(GClientSmokeBase):
super(GClientSmokeGIT, self).setUp() super(GClientSmokeGIT, self).setUp()
self.enabled = self.FAKE_REPOS.set_up_git() self.enabled = self.FAKE_REPOS.set_up_git()
def testSync(self): def testSyncManaged(self):
if not self.enabled: if not self.enabled:
return return
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) self.gclient([
'config', self.git_base + 'repo_1', '--name', 'src', '--managed'])
# Test unversioned checkout. # Test unversioned checkout.
self.parseGclient( self.parseGclient(
['sync', '--deps', 'mac', '--jobs', '1'], ['sync', '--deps', 'mac', '--jobs', '8'],
['running', 'running']) ['running', 'running'])
# TODO(maruel): http://crosbug.com/3582 hooks run even if not matching, must # TODO(maruel): http://crosbug.com/3582 hooks run even if not matching, must
# add sync parsing to get the list of updated files. # add sync parsing to get the list of updated files.
@ -311,7 +312,7 @@ class GClientSmokeGIT(GClientSmokeBase):
# Test incremental versioned sync: sync backward. # Test incremental versioned sync: sync backward.
self.parseGclient( self.parseGclient(
['sync', '--jobs', '1', '--revision', ['sync', '--jobs', '1', '--revision',
'src@' + self.githash('repo_1', 1), 'src@' + self.githash('repo_1', 1), '--jobs', '1',
'--deps', 'mac', '--delete_unversioned_trees'], '--deps', 'mac', '--delete_unversioned_trees'],
['deleting']) ['deleting'])
tree = self.mangle_git_tree(('repo_1@1', 'src'), tree = self.mangle_git_tree(('repo_1@1', 'src'),
@ -322,7 +323,7 @@ class GClientSmokeGIT(GClientSmokeBase):
self.assertTree(tree) self.assertTree(tree)
# Test incremental sync: delete-unversioned_trees isn't there. # Test incremental sync: delete-unversioned_trees isn't there.
self.parseGclient( self.parseGclient(
['sync', '--deps', 'mac', '--jobs', '1'], ['sync', '--deps', 'mac', '--jobs', '8'],
['running', 'running']) ['running', 'running'])
tree = self.mangle_git_tree(('repo_1@2', 'src'), tree = self.mangle_git_tree(('repo_1@2', 'src'),
('repo_2@1', 'src/repo2'), ('repo_2@1', 'src/repo2'),
@ -366,55 +367,6 @@ class GClientSmokeGIT(GClientSmokeBase):
('repo_4@2', 'src/repo4')) ('repo_4@2', 'src/repo4'))
self.assertTree(tree) self.assertTree(tree)
def testSyncJobs(self):
if not self.enabled:
return
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
# Test unversioned checkout.
self.parseGclient(
['sync', '--deps', 'mac', '--jobs', '8'],
['running', 'running'],
untangle=True)
# TODO(maruel): http://crosbug.com/3582 hooks run even if not matching, must
# add sync parsing to get the list of updated files.
tree = self.mangle_git_tree(('repo_1@2', 'src'),
('repo_2@1', 'src/repo2'),
('repo_3@2', 'src/repo2/repo_renamed'))
tree['src/git_hooked1'] = 'git_hooked1'
tree['src/git_hooked2'] = 'git_hooked2'
self.assertTree(tree)
# Manually remove git_hooked1 before synching to make sure it's not
# recreated.
os.remove(join(self.root_dir, 'src', 'git_hooked1'))
# Test incremental versioned sync: sync backward.
# Use --jobs 1 otherwise the order is not deterministic.
self.parseGclient(
['sync', '--revision', 'src@' + self.githash('repo_1', 1),
'--deps', 'mac', '--delete_unversioned_trees', '--jobs', '1'],
['deleting'],
untangle=True)
tree = self.mangle_git_tree(('repo_1@1', 'src'),
('repo_2@2', 'src/repo2'),
('repo_3@1', 'src/repo2/repo3'),
('repo_4@2', 'src/repo4'))
tree['src/git_hooked2'] = 'git_hooked2'
self.assertTree(tree)
# Test incremental sync: delete-unversioned_trees isn't there.
self.parseGclient(
['sync', '--deps', 'mac', '--jobs', '8'],
['running', 'running'],
untangle=True)
tree = self.mangle_git_tree(('repo_1@2', 'src'),
('repo_2@1', 'src/repo2'),
('repo_3@1', 'src/repo2/repo3'),
('repo_3@2', 'src/repo2/repo_renamed'),
('repo_4@2', 'src/repo4'))
tree['src/git_hooked1'] = 'git_hooked1'
tree['src/git_hooked2'] = 'git_hooked2'
self.assertTree(tree)
def testRunHooks(self): def testRunHooks(self):
if not self.enabled: if not self.enabled:
return return

Loading…
Cancel
Save