diff --git a/gclient.py b/gclient.py index a1d6f2e001..53fd398b1c 100755 --- a/gclient.py +++ b/gclient.py @@ -224,7 +224,7 @@ class DependencySettings(GClientKeywords): # 'managed' determines whether or not this dependency is synced/updated by # gclient after gclient checks it out initially. The difference between # '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 # recursion limit and controls gclient's behavior so it does not misbehave. 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 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 -want to set 'managed': False in .gclient. +%(checkout_path)s but the URL in .gclient is for an svn repository, you should +set 'managed': False in .gclient. ''' % {'checkout_path': os.path.join(self.root_dir, dep.name), 'expected_url': dep.url, 'expected_scm': gclient_scm.GetScmName(dep.url), @@ -1300,7 +1300,7 @@ want to set 'managed': False in .gclient. try: deps_to_add.append(Dependency( self, s['name'], s['url'], - s.get('managed', True), + s.get('managed', False), s.get('custom_deps', {}), s.get('custom_vars', {}), s.get('custom_hooks', []), @@ -1426,7 +1426,7 @@ been automagically updated. The previous version is available at %s.old. return client 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 % { 'solution_name': solution_name, 'solution_url': solution_url, @@ -1475,7 +1475,7 @@ been automagically updated. The previous version is available at %s.old. revision_overrides = {} if not self._options.revisions: 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) if not self._options.revisions: return revision_overrides @@ -1861,11 +1861,13 @@ def CMDconfig(parser, args): parser.add_option('--deps-file', default='DEPS', help='overrides the default name for the DEPS file for the' '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 ' - 'to have the main solution untouched by gclient ' - '(gclient will check out unmanaged dependencies but ' - 'will never sync them)') + 'to have the main solution managed by gclient ' + '(gclient will always auto-sync managed solutions ' + ' 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', help='(git only) Cache all git repos into this dir and do ' 'shared clones from the cache, instead of cloning ' @@ -1898,7 +1900,7 @@ def CMDconfig(parser, args): deps_file = options.deps_file client.SetDefaultConfig(name, deps_file, base_url, - managed=not options.unmanaged, + managed=options.managed, cache_dir=options.cache_dir) client.SaveConfig() return 0 diff --git a/tests/gclient_smoketest.py b/tests/gclient_smoketest.py index 51c5b4eef6..cefd7b00ce 100755 --- a/tests/gclient_smoketest.py +++ b/tests/gclient_smoketest.py @@ -209,7 +209,7 @@ class GClientSmoke(GClientSmokeBase): ' "name" : "src",\n' ' "url" : "%strunk/src",\n' ' "deps_file" : "DEPS",\n' - ' "managed" : True,\n' + ' "managed" : False,\n' ' "custom_deps" : {},\n' ' },\n' ']\n' @@ -221,7 +221,7 @@ class GClientSmoke(GClientSmokeBase): ' "name" : "src",\n' ' "url" : "%srepo_1",\n' ' "deps_file" : "DEPS",\n' - ' "managed" : True,\n' + ' "managed" : False,\n' ' "custom_deps" : {},\n' ' },\n' ']\n' @@ -233,7 +233,7 @@ class GClientSmoke(GClientSmokeBase): ' "name" : "foo",\n' ' "url" : "foo",\n' ' "deps_file" : "blah",\n' - ' "managed" : True,\n' + ' "managed" : False,\n' ' "custom_deps" : {},\n' ' },\n' ']\n' @@ -287,13 +287,14 @@ class GClientSmokeGIT(GClientSmokeBase): super(GClientSmokeGIT, self).setUp() self.enabled = self.FAKE_REPOS.set_up_git() - def testSync(self): + def testSyncManaged(self): if not self.enabled: 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. self.parseGclient( - ['sync', '--deps', 'mac', '--jobs', '1'], + ['sync', '--deps', 'mac', '--jobs', '8'], ['running', 'running']) # TODO(maruel): http://crosbug.com/3582 hooks run even if not matching, must # add sync parsing to get the list of updated files. @@ -311,7 +312,7 @@ class GClientSmokeGIT(GClientSmokeBase): # Test incremental versioned sync: sync backward. self.parseGclient( ['sync', '--jobs', '1', '--revision', - 'src@' + self.githash('repo_1', 1), + 'src@' + self.githash('repo_1', 1), '--jobs', '1', '--deps', 'mac', '--delete_unversioned_trees'], ['deleting']) tree = self.mangle_git_tree(('repo_1@1', 'src'), @@ -322,7 +323,7 @@ class GClientSmokeGIT(GClientSmokeBase): self.assertTree(tree) # Test incremental sync: delete-unversioned_trees isn't there. self.parseGclient( - ['sync', '--deps', 'mac', '--jobs', '1'], + ['sync', '--deps', 'mac', '--jobs', '8'], ['running', 'running']) tree = self.mangle_git_tree(('repo_1@2', 'src'), ('repo_2@1', 'src/repo2'), @@ -366,55 +367,6 @@ class GClientSmokeGIT(GClientSmokeBase): ('repo_4@2', 'src/repo4')) 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): if not self.enabled: return