Commit 0b1c246c authored by maruel@chromium.org's avatar maruel@chromium.org

Add automatic retry on "git remote update".

It does remote connection and can get HTTP 502 when used over http.

Review URL: http://codereview.chromium.org/661280

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@40330 0039d316-1c4b-4281-b951-d872f2087c98
parent 952d7c74
......@@ -251,10 +251,23 @@ class GitWrapper(SCMWrapper, scm.GIT):
else:
raise gclient_utils.Error('Invalid Upstream')
# Update the remotes first so we have all the refs
remote_output, remote_err = self.Capture(['remote'] + verbose + ['update'],
self.checkout_path,
print_error=False)
# Update the remotes first so we have all the refs.
for i in range(3):
try:
remote_output, remote_err = self.Capture(
['remote'] + verbose + ['update'],
self.checkout_path,
print_error=False)
break
except gclient_utils.CheckCallError, e:
# Hackish but at that point, git is known to work so just checking for
# 502 in stderr should be fine.
if '502' in e.stderr:
print str(e)
print "Retrying..."
continue
raise e
if verbose:
print remote_output.strip()
# git remote update prints to stderr when used with --verbose
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment