Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: gclient_scm.py

Issue 13470027: Revert "Make gclient fetch git repos recursively. This is needed when adding a git repo through DEP… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Gclient-specific SCM-specific operations.""" 5 """Gclient-specific SCM-specific operations."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import posixpath 9 import posixpath
10 import re 10 import re
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 filter_fn=GitDiffFilterer(self.relpath).Filter) 195 filter_fn=GitDiffFilterer(self.relpath).Filter)
196 196
197 def UpdateSubmoduleConfig(self): 197 def UpdateSubmoduleConfig(self):
198 submod_cmd = ['git', 'config', '-f', '$toplevel/.git/config', 198 submod_cmd = ['git', 'config', '-f', '$toplevel/.git/config',
199 'submodule.$name.ignore', '||', 199 'submodule.$name.ignore', '||',
200 'git', 'config', '-f', '$toplevel/.git/config', 200 'git', 'config', '-f', '$toplevel/.git/config',
201 'submodule.$name.ignore', 'all'] 201 'submodule.$name.ignore', 'all']
202 cmd = ['git', 'submodule', '--quiet', 'foreach', ' '.join(submod_cmd)] 202 cmd = ['git', 'submodule', '--quiet', 'foreach', ' '.join(submod_cmd)]
203 cmd2 = ['git', 'config', 'diff.ignoreSubmodules', 'all'] 203 cmd2 = ['git', 'config', 'diff.ignoreSubmodules', 'all']
204 cmd3 = ['git', 'config', 'branch.autosetupmerge'] 204 cmd3 = ['git', 'config', 'branch.autosetupmerge']
205 cmd4 = ['git', 'config', 'fetch.recurseSubmodules', 'true']
206 kwargs = {'cwd': self.checkout_path, 205 kwargs = {'cwd': self.checkout_path,
207 'print_stdout': False, 206 'print_stdout': False,
208 'filter_fn': lambda x: None} 207 'filter_fn': lambda x: None}
209 try: 208 try:
210 gclient_utils.CheckCallAndFilter(cmd, **kwargs) 209 gclient_utils.CheckCallAndFilter(cmd, **kwargs)
211 gclient_utils.CheckCallAndFilter(cmd2, **kwargs) 210 gclient_utils.CheckCallAndFilter(cmd2, **kwargs)
212 except subprocess2.CalledProcessError: 211 except subprocess2.CalledProcessError:
213 # Not a fatal error, or even very interesting in a non-git-submodule 212 # Not a fatal error, or even very interesting in a non-git-submodule
214 # world. So just keep it quiet. 213 # world. So just keep it quiet.
215 pass 214 pass
216 try: 215 try:
217 gclient_utils.CheckCallAndFilter(cmd3, **kwargs) 216 gclient_utils.CheckCallAndFilter(cmd3, **kwargs)
218 except subprocess2.CalledProcessError: 217 except subprocess2.CalledProcessError:
219 gclient_utils.CheckCallAndFilter(cmd3 + ['always'], **kwargs) 218 gclient_utils.CheckCallAndFilter(cmd3 + ['always'], **kwargs)
220 219
221 gclient_utils.CheckCallAndFilter(cmd4, **kwargs)
222
223 def update(self, options, args, file_list): 220 def update(self, options, args, file_list):
224 """Runs git to update or transparently checkout the working copy. 221 """Runs git to update or transparently checkout the working copy.
225 222
226 All updated files will be appended to file_list. 223 All updated files will be appended to file_list.
227 224
228 Raises: 225 Raises:
229 Error: if can't get URL for relative path. 226 Error: if can't get URL for relative path.
230 """ 227 """
231 if args: 228 if args:
232 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) 229 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args))
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 649
653 clone_cmd = ['clone', '--progress'] 650 clone_cmd = ['clone', '--progress']
654 if revision.startswith('refs/heads/'): 651 if revision.startswith('refs/heads/'):
655 clone_cmd.extend(['-b', revision.replace('refs/heads/', '')]) 652 clone_cmd.extend(['-b', revision.replace('refs/heads/', '')])
656 detach_head = False 653 detach_head = False
657 else: 654 else:
658 detach_head = True 655 detach_head = True
659 if options.verbose: 656 if options.verbose:
660 clone_cmd.append('--verbose') 657 clone_cmd.append('--verbose')
661 clone_cmd.extend([url, self.checkout_path]) 658 clone_cmd.extend([url, self.checkout_path])
662 clone_cmd.append('--recursive')
663 659
664 # If the parent directory does not exist, Git clone on Windows will not 660 # If the parent directory does not exist, Git clone on Windows will not
665 # create it, so we need to do it manually. 661 # create it, so we need to do it manually.
666 parent_dir = os.path.dirname(self.checkout_path) 662 parent_dir = os.path.dirname(self.checkout_path)
667 if not os.path.exists(parent_dir): 663 if not os.path.exists(parent_dir):
668 gclient_utils.safe_makedirs(parent_dir) 664 gclient_utils.safe_makedirs(parent_dir)
669 665
670 percent_re = re.compile('.* ([0-9]{1,2})% .*') 666 percent_re = re.compile('.* ([0-9]{1,2})% .*')
671 def _GitFilter(line): 667 def _GitFilter(line):
672 # git uses an escape sequence to clear the line; elide it. 668 # git uses an escape sequence to clear the line; elide it.
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 new_command.append('--force') 1251 new_command.append('--force')
1256 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1252 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1257 new_command.extend(('--accept', 'theirs-conflict')) 1253 new_command.extend(('--accept', 'theirs-conflict'))
1258 elif options.manually_grab_svn_rev: 1254 elif options.manually_grab_svn_rev:
1259 new_command.append('--force') 1255 new_command.append('--force')
1260 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1256 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1261 new_command.extend(('--accept', 'postpone')) 1257 new_command.extend(('--accept', 'postpone'))
1262 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1258 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1263 new_command.extend(('--accept', 'postpone')) 1259 new_command.extend(('--accept', 'postpone'))
1264 return new_command 1260 return new_command
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698