Index: scm.py |
diff --git a/scm.py b/scm.py |
index 23521b8d9cff59787322f7f99e818f9b7e105453..b577be5d4182194e1a21a9b440369ca6787f0d82 100644 |
--- a/scm.py |
+++ b/scm.py |
@@ -446,17 +446,46 @@ class SVN(object): |
True, |
CaptureMatchingLines) |
except gclient_utils.Error: |
- # We enforce that some progress has been made or HTTP 502. |
- if (filter(lambda x: '502 Bad Gateway' in x, failure) or |
- (len(failure) and len(file_list) > previous_list_len)): |
- if args[0] == 'checkout': |
- # An aborted checkout is now an update. |
+ # Subversion client is really misbehaving with Google Code. |
+ if args[0] == 'checkout': |
+ # Ensure at least one file was checked out, otherwise *delete* the |
+ # directory. |
+ if len(file_list) == previous_list_len: |
+ for x in failure: |
+ if ('502 Bad Gateway' in x or |
+ 'svn: REPORT of \'/svn/!svn/vcc/default\': 200 OK' in x): |
+ # No file were checked out, so make sure the directory is |
+ # deleted in case it's messed up and try again. |
+ # Warning: It's bad, it assumes args[2] is the directory |
+ # argument. |
+ if os.path.isdir(args[2]): |
+ chromium_utils.RemoveDirectory(args[2]) |
+ break |
+ else: |
+ # No known svn error was found, bail out. |
+ raise |
+ else: |
+ # Progress was made, convert to update since an aborted checkout |
+ # is now an update. |
args = ['update'] + args[1:] |
- print "Sleeping 15 seconds and retrying...." |
- time.sleep(15) |
- continue |
- # No progress was made or an unknown error we aren't sure, bail out. |
- raise |
+ else: |
+ # It was an update or export. |
+ # We enforce that some progress has been made or HTTP 502. |
+ if len(file_list) == previous_list_len: |
+ for x in failure: |
+ if ('502 Bad Gateway' in x or |
+ 'svn: REPORT of \'/svn/!svn/vcc/default\': 200 OK' in x): |
+ # Ok, know failure code. |
+ break |
+ else: |
+ # No known svn error was found, bail out. |
+ raise |
+ else: |
+ # Progress was made, it's fine. |
+ pass |
+ print "Sleeping 15 seconds and retrying...." |
+ time.sleep(15) |
+ continue |
break |
@staticmethod |