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