@ -13,6 +13,7 @@ from contextlib import contextmanager
import copy
import copy
import ctypes
import ctypes
from datetime import datetime
from datetime import datetime
import functools
import json
import json
import optparse
import optparse
import os
import os
@ -676,6 +677,19 @@ def _maybe_break_locks(checkout_path, tries=3):
pass
pass
def _set_git_config ( fn ) :
@functools.wraps ( fn )
def wrapper ( * args , * * kwargs ) :
with git_config_if_not_set ( ' user.name ' , ' chrome-bot ' ) , \
git_config_if_not_set ( ' user.email ' , ' chrome-bot@chromium.org ' ) :
if os . getenv ( ' PACKFILE_OFFLOADING ' ) == ' 1 ' :
with git_config_if_not_set ( ' fetch.uriprotocols ' , ' https ' ) :
return fn ( * args , * * kwargs )
return fn ( * args , * * kwargs )
return wrapper
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 , enforce_fetch ) :
cleanup_dir , enforce_fetch ) :
@ -864,6 +878,7 @@ def emit_json(out_file, did_run, gclient_output=None, **kwargs):
f . write ( json . dumps ( output , sort_keys = True ) )
f . write ( json . dumps ( output , sort_keys = True ) )
@_set_git_config
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 ,
@ -894,8 +909,6 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
for solution_name in list ( solution_dirs ) :
for solution_name in list ( solution_dirs ) :
gc_revisions [ solution_name ] = ' unmanaged '
gc_revisions [ solution_name ] = ' unmanaged '
with git_config_if_not_set ( ' user.name ' , ' chrome-bot ' ) , \
git_config_if_not_set ( ' user.email ' , ' chrome-bot@chromium.org ' ) :
# Let gclient do the DEPS syncing.
# Let gclient do the DEPS syncing.
# The branch-head refspec is a special case because it's possible Chrome
# The branch-head refspec is a special case because it's possible Chrome
# src, which contains the branch-head refspecs, is DEPSed in.
# src, which contains the branch-head refspecs, is DEPSed in.