bot_update: refactor giant git_checkout into two.

Change-Id: I2c023a538bfe62955238b39034ed7460286789e5
Reviewed-on: https://chromium-review.googlesource.com/771454
Reviewed-by: Jao-ke Chin-Lee <jchinlee@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
changes/54/771454/2
Andrii Shyshkalov 8 years ago committed by Commit Bot
parent 3d50d9c5b3
commit 1f620f0550

@ -561,7 +561,7 @@ def _maybe_break_locks(checkout_path):
raise
def git_checkout(solutions, revisions, shallow, refs, git_cache_dir,
def git_checkouts(solutions, revisions, shallow, refs, git_cache_dir,
cleanup_dir):
build_dir = os.getcwd()
# Before we do anything, break all git_cache locks.
@ -574,6 +574,18 @@ def git_checkout(solutions, revisions, shallow, refs, git_cache_dir,
raise Exception('%s exists after cache unlock' % filename)
first_solution = True
for sln in solutions:
_git_checkout(sln, build_dir, revisions, shallow, refs, git_cache_dir,
cleanup_dir)
if first_solution:
git_ref = git('log', '--format=%H', '--max-count=1',
cwd=path.join(build_dir, sln['name'])
).strip()
first_solution = False
return git_ref
def _git_checkout(sln, build_dir, revisions, shallow, refs, git_cache_dir,
cleanup_dir):
# 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
@ -655,12 +667,6 @@ def git_checkout(solutions, revisions, shallow, refs, git_cache_dir,
git('clean', '-dff', cwd=sln_dir)
if first_solution:
git_ref = git('log', '--format=%H', '--max-count=1',
cwd=sln_dir).strip()
first_solution = False
return git_ref
def _download(url):
"""Fetch url and return content, with retries for flake."""
@ -833,7 +839,7 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
# invoking DEPS.
print 'Fetching Git checkout'
git_ref = git_checkout(solutions, revisions, shallow, refs, git_cache_dir,
git_ref = git_checkouts(solutions, revisions, shallow, refs, git_cache_dir,
cleanup_dir)
print '===Processing patch solutions==='

Loading…
Cancel
Save