@ -678,13 +678,13 @@ def _maybe_break_locks(checkout_path, tries=3):
def git_checkouts ( solutions , revisions , refs , no_fetch_tags , git_cache_dir ,
def git_checkouts ( solutions , revisions , refs , no_fetch_tags , git_cache_dir ,
cleanup_dir ):
cleanup_dir , enforce_fetch ):
build_dir = os . getcwd ( )
build_dir = os . getcwd ( )
first_solution = True
first_solution = True
for sln in solutions :
for sln in solutions :
sln_dir = path . join ( build_dir , sln [ ' name ' ] )
sln_dir = path . join ( build_dir , sln [ ' name ' ] )
_git_checkout ( sln , sln_dir , revisions , refs , no_fetch_tags , git_cache_dir ,
_git_checkout ( sln , sln_dir , revisions , refs , no_fetch_tags , git_cache_dir ,
cleanup_dir )
cleanup_dir , enforce_fetch )
if first_solution :
if first_solution :
git_ref = git ( ' log ' , ' --format= % H ' , ' --max-count=1 ' ,
git_ref = git ( ' log ' , ' --format= % H ' , ' --max-count=1 ' ,
cwd = path . join ( build_dir , sln [ ' name ' ] )
cwd = path . join ( build_dir , sln [ ' name ' ] )
@ -694,7 +694,7 @@ def git_checkouts(solutions, revisions, refs, no_fetch_tags, git_cache_dir,
def _git_checkout ( sln , sln_dir , revisions , refs , no_fetch_tags , git_cache_dir ,
def _git_checkout ( sln , sln_dir , revisions , refs , no_fetch_tags , git_cache_dir ,
cleanup_dir ):
cleanup_dir , enforce_fetch ):
name = sln [ ' name ' ]
name = sln [ ' name ' ]
url = sln [ ' url ' ]
url = sln [ ' url ' ]
populate_cmd = ( [ ' cache ' , ' populate ' , ' --ignore_locks ' , ' -v ' ,
populate_cmd = ( [ ' cache ' , ' populate ' , ' --ignore_locks ' , ' -v ' ,
@ -715,6 +715,9 @@ def _git_checkout(sln, sln_dir, revisions, refs, no_fetch_tags, git_cache_dir,
branch , revision = get_target_branch_and_revision ( name , url , revisions )
branch , revision = get_target_branch_and_revision ( name , url , revisions )
pin = revision if COMMIT_HASH_RE . match ( revision ) else None
pin = revision if COMMIT_HASH_RE . match ( revision ) else None
if enforce_fetch :
git ( * populate_cmd , env = env )
# Step 1: populate/refresh cache, if necessary.
# Step 1: populate/refresh cache, if necessary.
if not pin :
if not pin :
# Refresh only once.
# Refresh only once.
@ -864,14 +867,14 @@ def emit_json(out_file, did_run, gclient_output=None, **kwargs):
def ensure_checkout ( solutions , revisions , first_sln , target_os , target_os_only ,
def ensure_checkout ( solutions , revisions , first_sln , target_os , target_os_only ,
target_cpu , patch_root , patch_refs , gerrit_rebase_patch_ref ,
target_cpu , patch_root , patch_refs , gerrit_rebase_patch_ref ,
no_fetch_tags , refs , git_cache_dir , cleanup_dir ,
no_fetch_tags , refs , git_cache_dir , cleanup_dir ,
gerrit_reset , disable_syntax_validation ):
gerrit_reset , disable_syntax_validation , enforce_fetch ):
# Get a checkout of each solution, without DEPS or hooks.
# Get a checkout of each solution, without DEPS or hooks.
# Calling git directly because there is no way to run Gclient without
# Calling git directly because there is no way to run Gclient without
# invoking DEPS.
# invoking DEPS.
print ( ' Fetching Git checkout ' )
print ( ' Fetching Git checkout ' )
git_checkouts ( solutions , revisions , refs , no_fetch_tags , git_cache_dir ,
git_checkouts ( solutions , revisions , refs , no_fetch_tags , git_cache_dir ,
cleanup_dir )
cleanup_dir , enforce_fetch )
# Ensure our build/ directory is set up with the correct .gclient file.
# Ensure our build/ directory is set up with the correct .gclient file.
gclient_configure ( solutions , target_os , target_os_only , target_cpu ,
gclient_configure ( solutions , target_os , target_os_only , target_cpu ,
@ -1130,6 +1133,7 @@ def checkout(options, git_slns, specs, revisions, step_text):
# Control how the fetch step will occur.
# Control how the fetch step will occur.
no_fetch_tags = options . no_fetch_tags ,
no_fetch_tags = options . no_fetch_tags ,
enforce_fetch = options . enforce_fetch ,
# Finally, extra configurations cleanup dir location.
# Finally, extra configurations cleanup dir location.
refs = options . refs ,
refs = options . refs ,