Bug 538528 - Allow client.py network attempts to restart itself in case of failures; (Cv1) Never retry 'cvs checkout', Rewrite its call, Improve documentation.
authorSerge Gautherie <sgautherie.bz@free.fr>
Wed, 17 Mar 2010 17:54:06 +0100
changeset 5198 7944965052d44ebb311b7cbfcf465a5d1a072a95
parent 5197 bd28fdcccd82a37dac36a91592d99d2d4d16227c
child 5199 cef0f15b47182dd85ac7a1aecd333c2de5b82e67
push idunknown
push userunknown
push dateunknown
bugs538528
Bug 538528 - Allow client.py network attempts to restart itself in case of failures; (Cv1) Never retry 'cvs checkout', Rewrite its call, Improve documentation. r=gozer.
client.py
--- a/client.py
+++ b/client.py
@@ -284,40 +284,37 @@ def do_hg_pull(dir, repository, hg, rev)
             cmd.append(repository)
         check_call_noisy(cmd, retryMax=options.retries)
 
     # update to specific revision
     cmd = [hg, 'update', '-r', rev, '-R', fulldir ] + hgopts
     if options.verbose:
         cmd.append('-v')
     # Explicitly never retry 'hg update': otherwise any merge failures are ignored.
+    # This command is local: a failure can't be caused by a network error.
     check_call_noisy(cmd, retryMax=0)
 
     check_call([hg, 'parent', '-R', fulldir,
                 '--template=Updated to revision {node}.\n'])
 
 def do_cvs_checkout(modules, tag, cvsroot, cvs, checkoutdir):
     """Check out a CVS directory into the checkoutdir subdirectory.
     modules is a list of directories to check out, e.g. ['extensions/irc']
     """
     for module in modules:
         (parent, leaf) = os.path.split(module)
         print "CVS checkout begin: " + datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC")
-        if tag == 'HEAD':
-            check_call_noisy([cvs, '-d', cvsroot, '-q',
-                              'checkout', '-P', '-A', '-d', leaf,
-                              'mozilla/%s' % module],
-                             cwd=os.path.join(topsrcdir, checkoutdir, parent),
-                             retryMax=options.retries)
-        else:
-            check_call_noisy([cvs, '-d', cvsroot, '-q',
-                              'checkout', '-P', '-r', tag, '-d', leaf,
-                              'mozilla/%s' % module],
-                             cwd=os.path.join(topsrcdir, checkoutdir, parent),
-                             retryMax=options.retries)
+        revopt = ((tag == 'HEAD') and ['-A']) or ['-r', tag]
+        # Explicitly never retry 'cvs checkout': otherwise any merge failures are ignored.
+        # No way to tell whether a failure is caused by a network error or a local conflict: better be safe.
+        check_call_noisy([cvs, '-d', cvsroot, '-q',
+                          'checkout', '-P'] + revopt + ['-d', leaf,
+                          'mozilla/%s' % module],
+                         retryMax=0,
+                         cwd=os.path.join(topsrcdir, checkoutdir, parent))
         print "CVS checkout end: " + datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC")
 
 def check_retries_option(option, opt_str, value, parser):
   if value < 0:
     raise OptionValueError("%s option value needs to be positive (not '%d')" % (opt_str, value))
   setattr(parser.values, option.dest, value)
 
 o = OptionParser(usage="%prog [options] checkout")