gclient: Add skip-git experiment.

This experiment causes all dependencies of type 'git' to be skipped for
all commands. This can be useful if you need to build Chromium in a
working tree that is guaranteed to contain a consistent, pre-synced
snapshot of the code that's managed by Git, but still need to install
cipd dependencies and run the hooks to download the remaining
dependencies.

Bug: b/310485239
Change-Id: Iee1e6a4d62b867b6d7235903817f927a9e806dc1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5018571
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Philipp Wollermann <philwo@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
changes/71/5018571/2
Philipp Wollermann 1 year ago committed by LUCI CQ
parent 7f22330c69
commit 8672d51b79

@ -128,6 +128,13 @@ PREVIOUS_SYNC_COMMITS = 'GCLIENT_PREVIOUS_SYNC_COMMITS'
NO_SYNC_EXPERIMENT = 'no-sync'
# This experiment causes all dependencies of type 'git' to be skipped for all
# commands. This can be useful if you need to build Chromium in a working
# tree that is guaranteed to contain a consistent, pre-synced snapshot of the
# code that's managed by Git, but still need to install cipd dependencies and
# run the hooks to download the remaining dependencies.
SKIP_GIT_EXPERIMENT = 'skip-git'
PRECOMMIT_HOOK_VAR = 'GCLIENT_PRECOMMIT'
@ -1105,6 +1112,10 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
# working copy state, so skip the SCM status check.
run_scm = command not in ('flatten', 'runhooks', 'recurse', 'validate',
None)
# See the description of the experiment for the logic behind this.
if SKIP_GIT_EXPERIMENT in options.experiments and isinstance(
self, GitDependency):
run_scm = False
file_list = [] if not options.nohooks else None
revision_override = revision_overrides.pop(
self.FuzzyMatchUrl(revision_overrides), None)

Loading…
Cancel
Save