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

Unified Diff: gclient_scm.py

Issue 661280: Add automatic retry on "git remote update". (Closed)
Patch Set: Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index 26d9a1588de1caa5b19d8690d65fa915c191df04..36f043b3c089068cd75e83ac7e55c7efc9b8c078 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698