Commit f151da9f authored by Andrii Shyshkalov's avatar Andrii Shyshkalov Committed by Commit Bot

bot_update: refactor _git_checkout moving invariants out of the loop.

Bug:
Change-Id: Ie8781f73236e13c0afedf18dacf770d14563ab9f
Reviewed-on: https://chromium-review.googlesource.com/771857Reviewed-by: 's avatarJao-ke Chin-Lee <jchinlee@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
parent 331a276b
......@@ -589,6 +589,19 @@ def git_checkouts(solutions, revisions, shallow, refs, git_cache_dir,
def _git_checkout(sln, build_dir, revisions, shallow, refs, git_cache_dir,
cleanup_dir):
name = sln['name']
url = sln['url']
if url == CHROMIUM_SRC_URL or url + '.git' == CHROMIUM_SRC_URL:
# Experiments show there's little to be gained from
# a shallow clone of src.
shallow = False
sln_dir = path.join(build_dir, name)
s = ['--shallow'] if shallow else []
populate_cmd = (['cache', 'populate', '--ignore_locks', '-v',
'--cache-dir', git_cache_dir] + s + [url])
for ref in refs:
populate_cmd.extend(['--ref', ref])
# Just in case we're hitting a different git server than the one from
# which the target revision was polled, we retry some.
done = False
......@@ -599,18 +612,6 @@ def _git_checkout(sln, build_dir, revisions, shallow, refs, git_cache_dir,
deadline = time.time() + 60
tries = 0
while not done:
name = sln['name']
url = sln['url']
if url == CHROMIUM_SRC_URL or url + '.git' == CHROMIUM_SRC_URL:
# Experiments show there's little to be gained from
# a shallow clone of src.
shallow = False
sln_dir = path.join(build_dir, name)
s = ['--shallow'] if shallow else []
populate_cmd = (['cache', 'populate', '--ignore_locks', '-v',
'--cache-dir', git_cache_dir] + s + [url])
for ref in refs:
populate_cmd.extend(['--ref', ref])
git(*populate_cmd)
mirror_dir = git(
'cache', 'exists', '--quiet',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment