From 260ab401aa0bce98a1c8a38d4f6dd4f79636c3a3 Mon Sep 17 00:00:00 2001 From: Dan Jacques Date: Tue, 15 Nov 2016 16:49:04 -0800 Subject: [PATCH] Remote nested retries on checkout. Remove nested retries on checkout. Since the outer loop handles retries specially, we want to let it exclusively handle retries. This will prevent the inner retry loop triggering a timeout condition (rather than a failure condition) with the outer loop. BUG=chromium:665116 TEST=None Change-Id: I4bf0c08b75861bf1c95060452118c314a121f9f3 Reviewed-on: https://chromium-review.googlesource.com/411397 Reviewed-by: Ryan Tseng Commit-Queue: Ryan Tseng --- recipe_modules/bot_update/resources/bot_update.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/recipe_modules/bot_update/resources/bot_update.py b/recipe_modules/bot_update/resources/bot_update.py index bae22ae84..d34a9f44e 100755 --- a/recipe_modules/bot_update/resources/bot_update.py +++ b/recipe_modules/bot_update/resources/bot_update.py @@ -470,10 +470,10 @@ def force_revision(folder_name, revision): branch, revision = split_revision if revision and revision.upper() != 'HEAD': - git('checkout', '--force', revision, cwd=folder_name) + git('checkout', '--force', revision, cwd=folder_name, tries=1) else: ref = branch if branch.startswith('refs/') else 'origin/%s' % branch - git('checkout', '--force', ref, cwd=folder_name) + git('checkout', '--force', ref, cwd=folder_name, tries=1) def is_broken_repo_dir(repo_dir): @@ -544,14 +544,15 @@ def git_checkout(solutions, revisions, shallow, refs, git_cache_dir): print 'Git repo %s appears to be broken, removing it' % sln_dir remove(sln_dir) + # Use "tries=1", since we retry manually in this loop. if not path.isdir(sln_dir): - git(*clone_cmd) + git(*clone_cmd, tries=1) else: - git('remote', 'set-url', 'origin', mirror_dir, cwd=sln_dir) - git('fetch', 'origin', cwd=sln_dir) + git('remote', 'set-url', 'origin', mirror_dir, cwd=sln_dir, tries=1) + git('fetch', 'origin', cwd=sln_dir, tries=1) for ref in refs: refspec = '%s:%s' % (ref, ref.lstrip('+')) - git('fetch', 'origin', refspec, cwd=sln_dir) + git('fetch', 'origin', refspec, cwd=sln_dir, tries=1) # Windows sometimes has trouble deleting files. # This can make git commands that rely on locks fail.