Standardize automatic retry and add a 15 seconds sleep to increase the chances of success

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@46067 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/scm.py b/scm.py
index a9b1ecf..038d2dd 100644
--- a/scm.py
+++ b/scm.py
@@ -11,6 +11,7 @@
 import subprocess
 import sys
 import tempfile
+import time
 import xml.dom.minidom
 
 import gclient_utils
@@ -399,7 +400,7 @@
         }[args[0]]
     compiled_pattern = re.compile(pattern)
     # Place an upper limit.
-    for _ in range(1, 10):
+    for _ in range(10):
       previous_list_len = len(file_list)
       failure = []
 
@@ -423,6 +424,8 @@
           if args[0] == 'checkout':
             # 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