From 8672d51b794308a6c1dacf7fe87d795186992c7e Mon Sep 17 00:00:00 2001 From: Philipp Wollermann Date: Mon, 13 Nov 2023 17:47:19 +0000 Subject: [PATCH] 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 Auto-Submit: Philipp Wollermann Commit-Queue: Josip Sokcevic --- gclient.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gclient.py b/gclient.py index 9d490f8a9..c1d23b4f8 100755 --- a/gclient.py +++ b/gclient.py @@ -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)