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

Side by Side Diff: gclient_scm.py

Issue 2241843002: gclient: kill git fetch operation that hangs. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Nits. Created 4 years, 3 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
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | 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 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
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))
1202 cfg = gclient_utils.DefaultIndexPackConfig(self.url) 1203 cfg = gclient_utils.DefaultIndexPackConfig(self.url)
1203 fetch_cmd = cfg + [ 1204 fetch_cmd = cfg + [
1204 'fetch', 1205 'fetch',
1205 remote or self.remote, 1206 remote or self.remote,
1206 ] 1207 ]
1207 1208
1208 if prune: 1209 if prune:
1209 fetch_cmd.append('--prune') 1210 fetch_cmd.append('--prune')
1210 if options.verbose: 1211 if options.verbose:
1211 fetch_cmd.append('--verbose') 1212 fetch_cmd.append('--verbose')
1212 elif quiet: 1213 elif quiet:
1213 fetch_cmd.append('--quiet') 1214 fetch_cmd.append('--quiet')
1214 self._Run(fetch_cmd, options, show_header=options.verbose, retry=True) 1215 self._Run(fetch_cmd, options, show_header=options.verbose, retry=True,
1216 kill_timeout=kill_timeout)
1215 1217
1216 # Return the revision that was fetched; this will be stored in 'FETCH_HEAD' 1218 # Return the revision that was fetched; this will be stored in 'FETCH_HEAD'
1217 return self._Capture(['rev-parse', '--verify', 'FETCH_HEAD']) 1219 return self._Capture(['rev-parse', '--verify', 'FETCH_HEAD'])
1218 1220
1219 def _UpdateBranchHeads(self, options, fetch=False): 1221 def _UpdateBranchHeads(self, options, fetch=False):
1220 """Adds, and optionally fetches, "branch-heads" and "tags" refspecs 1222 """Adds, and optionally fetches, "branch-heads" and "tags" refspecs
1221 if requested.""" 1223 if requested."""
1222 need_fetch = fetch 1224 need_fetch = fetch
1223 if hasattr(options, 'with_branch_heads') and options.with_branch_heads: 1225 if hasattr(options, 'with_branch_heads') and options.with_branch_heads:
1224 config_cmd = ['config', 'remote.%s.fetch' % self.remote, 1226 config_cmd = ['config', 'remote.%s.fetch' % self.remote,
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 new_command.append('--force') 1729 new_command.append('--force')
1728 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1730 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1729 new_command.extend(('--accept', 'theirs-conflict')) 1731 new_command.extend(('--accept', 'theirs-conflict'))
1730 elif options.manually_grab_svn_rev: 1732 elif options.manually_grab_svn_rev:
1731 new_command.append('--force') 1733 new_command.append('--force')
1732 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1734 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1733 new_command.extend(('--accept', 'postpone')) 1735 new_command.extend(('--accept', 'postpone'))
1734 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1736 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1735 new_command.extend(('--accept', 'postpone')) 1737 new_command.extend(('--accept', 'postpone'))
1736 return new_command 1738 return new_command
OLDNEW
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698