mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-09-27 09:10:38 +00:00
command: Respect smart sync override declaratively by default
Introduce a `RESPECT_SMART_SYNC_OVERRIDE` class attribute to the base `Command` class, defaulting to `True`. This allows subcommands to automatically respect the smart sync override manifest if it exists. The override is applied in `CommonValidateOptions` before any subcommand-specific validation or execution occurs. The `sync` and `init` commands explicitly opt out. This ensures all workspace-aware subcommands consistently align with the active smart sync override manifest. It also fixes a bug in multi-manifest setups where running a command from a submanifest would not apply the override to the outer manifest, causing inconsistency when resolving projects across all manifests. Bug: 279204331 Change-Id: I9426e90a13a77ce6bd94b4a82efda4d485cbe116 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/585081 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
This commit is contained in:
committed by
gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
54fa31cd84
commit
4bec297eb6
+10
@@ -66,6 +66,10 @@ class Command:
|
||||
# command to show short-vs-full summaries.
|
||||
COMMON = False
|
||||
|
||||
# Whether this command should respect the smart sync override manifest if
|
||||
# it exists.
|
||||
RESPECT_SMART_SYNC_OVERRIDE = True
|
||||
|
||||
# Whether this command supports running in parallel. If greater than 0,
|
||||
# it is the number of parallel jobs to default to.
|
||||
PARALLEL_JOBS = None
|
||||
@@ -247,6 +251,12 @@ class Command:
|
||||
# from the user's perspective.
|
||||
opt.outer_manifest = True
|
||||
|
||||
if self.RESPECT_SMART_SYNC_OVERRIDE:
|
||||
if self.manifest:
|
||||
self.TryOverrideManifestWithSmartSync(self.manifest)
|
||||
if self.outer_manifest and self.outer_manifest != self.manifest:
|
||||
self.TryOverrideManifestWithSmartSync(self.outer_manifest)
|
||||
|
||||
def ValidateOptions(self, opt, args):
|
||||
"""Validate the user options & arguments before executing.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user