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 from __future__ import print_function | 7 from __future__ import print_function |
8 | 8 |
9 import errno | 9 import errno |
10 import logging | 10 import logging |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 quiet = (not options.verbose) | 1192 quiet = (not options.verbose) |
1193 checkout_args = ['checkout'] | 1193 checkout_args = ['checkout'] |
1194 if force: | 1194 if force: |
1195 checkout_args.append('--force') | 1195 checkout_args.append('--force') |
1196 if quiet: | 1196 if quiet: |
1197 checkout_args.append('--quiet') | 1197 checkout_args.append('--quiet') |
1198 checkout_args.append(ref) | 1198 checkout_args.append(ref) |
1199 return self._Capture(checkout_args) | 1199 return self._Capture(checkout_args) |
1200 | 1200 |
1201 def _Fetch(self, options, remote=None, prune=False, quiet=False): | 1201 def _Fetch(self, options, remote=None, prune=False, quiet=False): |
1202 kill_timeout = float(os.getenv('GCLIENT_KILL_GIT_FETCH_AFTER', 0)) | |
1203 cfg = gclient_utils.DefaultIndexPackConfig(self.url) | 1202 cfg = gclient_utils.DefaultIndexPackConfig(self.url) |
1204 fetch_cmd = cfg + [ | 1203 fetch_cmd = cfg + [ |
1205 'fetch', | 1204 'fetch', |
1206 remote or self.remote, | 1205 remote or self.remote, |
1207 ] | 1206 ] |
1208 | 1207 |
1209 if prune: | 1208 if prune: |
1210 fetch_cmd.append('--prune') | 1209 fetch_cmd.append('--prune') |
1211 if options.verbose: | 1210 if options.verbose: |
1212 fetch_cmd.append('--verbose') | 1211 fetch_cmd.append('--verbose') |
1213 elif quiet: | 1212 elif quiet: |
1214 fetch_cmd.append('--quiet') | 1213 fetch_cmd.append('--quiet') |
1215 self._Run(fetch_cmd, options, show_header=options.verbose, retry=True, | 1214 self._Run(fetch_cmd, options, show_header=options.verbose, retry=True) |
1216 kill_timeout=kill_timeout) | |
1217 | 1215 |
1218 # Return the revision that was fetched; this will be stored in 'FETCH_HEAD' | 1216 # Return the revision that was fetched; this will be stored in 'FETCH_HEAD' |
1219 return self._Capture(['rev-parse', '--verify', 'FETCH_HEAD']) | 1217 return self._Capture(['rev-parse', '--verify', 'FETCH_HEAD']) |
1220 | 1218 |
1221 def _UpdateBranchHeads(self, options, fetch=False): | 1219 def _UpdateBranchHeads(self, options, fetch=False): |
1222 """Adds, and optionally fetches, "branch-heads" and "tags" refspecs | 1220 """Adds, and optionally fetches, "branch-heads" and "tags" refspecs |
1223 if requested.""" | 1221 if requested.""" |
1224 need_fetch = fetch | 1222 need_fetch = fetch |
1225 if hasattr(options, 'with_branch_heads') and options.with_branch_heads: | 1223 if hasattr(options, 'with_branch_heads') and options.with_branch_heads: |
1226 config_cmd = ['config', 'remote.%s.fetch' % self.remote, | 1224 config_cmd = ['config', 'remote.%s.fetch' % self.remote, |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1729 new_command.append('--force') | 1727 new_command.append('--force') |
1730 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1728 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1731 new_command.extend(('--accept', 'theirs-conflict')) | 1729 new_command.extend(('--accept', 'theirs-conflict')) |
1732 elif options.manually_grab_svn_rev: | 1730 elif options.manually_grab_svn_rev: |
1733 new_command.append('--force') | 1731 new_command.append('--force') |
1734 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1732 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1735 new_command.extend(('--accept', 'postpone')) | 1733 new_command.extend(('--accept', 'postpone')) |
1736 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1734 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1737 new_command.extend(('--accept', 'postpone')) | 1735 new_command.extend(('--accept', 'postpone')) |
1738 return new_command | 1736 return new_command |
OLD | NEW |