OLD | NEW |
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 Loading... |
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'] |
205 kwargs = {'cwd': self.checkout_path, | 206 kwargs = {'cwd': self.checkout_path, |
206 'print_stdout': False, | 207 'print_stdout': False, |
207 'filter_fn': lambda x: None} | 208 'filter_fn': lambda x: None} |
208 try: | 209 try: |
209 gclient_utils.CheckCallAndFilter(cmd, **kwargs) | 210 gclient_utils.CheckCallAndFilter(cmd, **kwargs) |
210 gclient_utils.CheckCallAndFilter(cmd2, **kwargs) | 211 gclient_utils.CheckCallAndFilter(cmd2, **kwargs) |
211 except subprocess2.CalledProcessError: | 212 except subprocess2.CalledProcessError: |
212 # Not a fatal error, or even very interesting in a non-git-submodule | 213 # Not a fatal error, or even very interesting in a non-git-submodule |
213 # world. So just keep it quiet. | 214 # world. So just keep it quiet. |
214 pass | 215 pass |
215 try: | 216 try: |
216 gclient_utils.CheckCallAndFilter(cmd3, **kwargs) | 217 gclient_utils.CheckCallAndFilter(cmd3, **kwargs) |
217 except subprocess2.CalledProcessError: | 218 except subprocess2.CalledProcessError: |
218 gclient_utils.CheckCallAndFilter(cmd3 + ['always'], **kwargs) | 219 gclient_utils.CheckCallAndFilter(cmd3 + ['always'], **kwargs) |
219 | 220 |
| 221 gclient_utils.CheckCallAndFilter(cmd4, **kwargs) |
| 222 |
220 def update(self, options, args, file_list): | 223 def update(self, options, args, file_list): |
221 """Runs git to update or transparently checkout the working copy. | 224 """Runs git to update or transparently checkout the working copy. |
222 | 225 |
223 All updated files will be appended to file_list. | 226 All updated files will be appended to file_list. |
224 | 227 |
225 Raises: | 228 Raises: |
226 Error: if can't get URL for relative path. | 229 Error: if can't get URL for relative path. |
227 """ | 230 """ |
228 if args: | 231 if args: |
229 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) | 232 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 | 652 |
650 clone_cmd = ['clone', '--progress'] | 653 clone_cmd = ['clone', '--progress'] |
651 if revision.startswith('refs/heads/'): | 654 if revision.startswith('refs/heads/'): |
652 clone_cmd.extend(['-b', revision.replace('refs/heads/', '')]) | 655 clone_cmd.extend(['-b', revision.replace('refs/heads/', '')]) |
653 detach_head = False | 656 detach_head = False |
654 else: | 657 else: |
655 detach_head = True | 658 detach_head = True |
656 if options.verbose: | 659 if options.verbose: |
657 clone_cmd.append('--verbose') | 660 clone_cmd.append('--verbose') |
658 clone_cmd.extend([url, self.checkout_path]) | 661 clone_cmd.extend([url, self.checkout_path]) |
| 662 clone_cmd.append('--recursive') |
659 | 663 |
660 # If the parent directory does not exist, Git clone on Windows will not | 664 # If the parent directory does not exist, Git clone on Windows will not |
661 # create it, so we need to do it manually. | 665 # create it, so we need to do it manually. |
662 parent_dir = os.path.dirname(self.checkout_path) | 666 parent_dir = os.path.dirname(self.checkout_path) |
663 if not os.path.exists(parent_dir): | 667 if not os.path.exists(parent_dir): |
664 gclient_utils.safe_makedirs(parent_dir) | 668 gclient_utils.safe_makedirs(parent_dir) |
665 | 669 |
666 percent_re = re.compile('.* ([0-9]{1,2})% .*') | 670 percent_re = re.compile('.* ([0-9]{1,2})% .*') |
667 def _GitFilter(line): | 671 def _GitFilter(line): |
668 # git uses an escape sequence to clear the line; elide it. | 672 # git uses an escape sequence to clear the line; elide it. |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 new_command.append('--force') | 1254 new_command.append('--force') |
1251 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1255 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1252 new_command.extend(('--accept', 'theirs-conflict')) | 1256 new_command.extend(('--accept', 'theirs-conflict')) |
1253 elif options.manually_grab_svn_rev: | 1257 elif options.manually_grab_svn_rev: |
1254 new_command.append('--force') | 1258 new_command.append('--force') |
1255 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1259 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1256 new_command.extend(('--accept', 'postpone')) | 1260 new_command.extend(('--accept', 'postpone')) |
1257 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1261 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1258 new_command.extend(('--accept', 'postpone')) | 1262 new_command.extend(('--accept', 'postpone')) |
1259 return new_command | 1263 return new_command |
OLD | NEW |