OLD | NEW |
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 if not upstream_branch or not upstream_branch.startswith('refs/remotes'): | 249 if not upstream_branch or not upstream_branch.startswith('refs/remotes'): |
250 current_type = "hash" | 250 current_type = "hash" |
251 logging.debug("Current branch is not tracking an upstream (remote)" | 251 logging.debug("Current branch is not tracking an upstream (remote)" |
252 " branch.") | 252 " branch.") |
253 elif upstream_branch.startswith('refs/remotes'): | 253 elif upstream_branch.startswith('refs/remotes'): |
254 current_type = "branch" | 254 current_type = "branch" |
255 else: | 255 else: |
256 raise gclient_utils.Error('Invalid Upstream: %s' % upstream_branch) | 256 raise gclient_utils.Error('Invalid Upstream: %s' % upstream_branch) |
257 | 257 |
258 # Update the remotes first so we have all the refs. | 258 # Update the remotes first so we have all the refs. |
| 259 backoff_time = 5 |
259 for _ in range(10): | 260 for _ in range(10): |
260 try: | 261 try: |
261 remote_output, remote_err = scm.GIT.Capture( | 262 remote_output, remote_err = scm.GIT.Capture( |
262 ['remote'] + verbose + ['update'], | 263 ['remote'] + verbose + ['update'], |
263 self.checkout_path, | 264 self.checkout_path, |
264 print_error=False) | 265 print_error=False) |
265 break | 266 break |
266 except gclient_utils.CheckCallError, e: | 267 except gclient_utils.CheckCallError, e: |
267 # Hackish but at that point, git is known to work so just checking for | 268 # Hackish but at that point, git is known to work so just checking for |
268 # 502 in stderr should be fine. | 269 # 502 in stderr should be fine. |
269 if '502' in e.stderr: | 270 if '502' in e.stderr: |
270 options.stdout.write(str(e) + '\n') | 271 options.stdout.write(str(e) + '\n') |
271 options.stdout.write('Sleeping 15 seconds and retrying...\n') | 272 options.stdout.write('Sleeping %.1f seconds and retrying...\n' % |
272 time.sleep(15) | 273 backoff_time) |
| 274 time.sleep(backoff_time) |
| 275 backoff_time *= 1.3 |
273 continue | 276 continue |
274 raise | 277 raise |
275 | 278 |
276 if verbose: | 279 if verbose: |
277 options.stdout.write(remote_output.strip() + '\n') | 280 options.stdout.write(remote_output.strip() + '\n') |
278 # git remote update prints to stderr when used with --verbose | 281 # git remote update prints to stderr when used with --verbose |
279 options.stdout.write(remote_err.strip() + '\n') | 282 options.stdout.write(remote_err.strip() + '\n') |
280 | 283 |
281 # This is a big hammer, debatable if it should even be here... | 284 # This is a big hammer, debatable if it should even be here... |
282 if options.force or options.reset: | 285 if options.force or options.reset: |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 | 978 |
976 This method returns a new list to be used as a command.""" | 979 This method returns a new list to be used as a command.""" |
977 new_command = command[:] | 980 new_command = command[:] |
978 if revision: | 981 if revision: |
979 new_command.extend(['--revision', str(revision).strip()]) | 982 new_command.extend(['--revision', str(revision).strip()]) |
980 # --force was added to 'svn update' in svn 1.5. | 983 # --force was added to 'svn update' in svn 1.5. |
981 if ((options.force or options.manually_grab_svn_rev) and | 984 if ((options.force or options.manually_grab_svn_rev) and |
982 scm.SVN.AssertVersion("1.5")[0]): | 985 scm.SVN.AssertVersion("1.5")[0]): |
983 new_command.append('--force') | 986 new_command.append('--force') |
984 return new_command | 987 return new_command |
OLD | NEW |