sync: Deprecate fetch-submodules flag names

The names for flags --fetch-submodules / --no-fetch-submodules are
misleading, since they impact the full sync operation (fetch and
checkout), not just the fetching.

Introduce new flags --recurse-submodules / --no-recurse-submodules
and treat the old ones as deprecated aliases.

Change-Id: I78339a3e0496a855c222c1869b27b578507886a7
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/608881
Commit-Queue: Josef Malmstrom <Josef.Malmstrom@arm.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Josef Malmstrom <Josef.Malmstrom@arm.com>
This commit is contained in:
Josef Malmström
2026-07-21 00:19:21 -07:00
committed by gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com
parent eeba6f268d
commit dd1130352b
5 changed files with 82 additions and 28 deletions
+38 -12
View File
@@ -378,9 +378,12 @@ resumeable bundle file on a content delivery network. This
may be necessary if there are problems with the local Python
HTTP client or proxy configuration, but the Git binary works.
The --fetch-submodules option enables fetching Git submodules
of all projects from the server. The --no-fetch-submodules option disables
fetching Git submodules, even when a project has sync-s="true" in the manifest.
The --recurse-submodules option enables syncing Git submodules of all projects
from the server. The --no-recurse-submodules option disables syncing Git
submodules, even when a project has sync-s="true" in the manifest.
The --fetch-submodules and --no-fetch-submodules options are deprecated aliases
for --recurse-submodules and --no-recurse-submodules, respectively.
The -c/--current-branch option can be used to only fetch objects that
are on the branch specified by a project's revision.
@@ -428,6 +431,15 @@ later is required to fix a server side protocol bug.
_JOBS_WARN_THRESHOLD = 100
@staticmethod
def _deprecated_submodules_option(option, opt_str, _value, parser):
enabled = opt_str == "--fetch-submodules"
replacement = (
"--recurse-submodules" if enabled else "--no-recurse-submodules"
)
logger.warning("%s is deprecated; use %s instead", opt_str, replacement)
setattr(parser.values, option.dest, enabled)
def _Options(self, p, show_smart=True):
p.add_option(
"--jobs-network",
@@ -570,15 +582,29 @@ later is required to fix a server side protocol bug.
help="password to authenticate with the manifest server",
)
p.add_option(
"--fetch-submodules",
"--recurse-submodules",
action="store_true",
help="fetch submodules from server",
help="sync submodules from server",
)
p.add_option(
"--no-recurse-submodules",
dest="recurse_submodules",
action="store_false",
help="don't sync submodules from server",
)
p.add_option(
"--fetch-submodules",
dest="recurse_submodules",
action="callback",
callback=self._deprecated_submodules_option,
help=optparse.SUPPRESS_HELP,
)
p.add_option(
"--no-fetch-submodules",
dest="fetch_submodules",
action="store_false",
help="don't fetch submodules from server",
dest="recurse_submodules",
action="callback",
callback=self._deprecated_submodules_option,
help=optparse.SUPPRESS_HELP,
)
p.add_option(
"--use-superproject",
@@ -749,7 +775,7 @@ later is required to fix a server side protocol bug.
all_projects = self.GetProjects(
args,
missing_ok=True,
submodules_ok=opt.fetch_submodules,
submodules_ok=opt.recurse_submodules,
manifest=manifest,
all_manifests=not opt.this_manifest_only,
)
@@ -1078,7 +1104,7 @@ later is required to fix a server side protocol bug.
all_projects = self.GetProjects(
args,
missing_ok=True,
submodules_ok=opt.fetch_submodules,
submodules_ok=opt.recurse_submodules,
manifest=manifest,
all_manifests=not opt.this_manifest_only,
)
@@ -2325,7 +2351,7 @@ later is required to fix a server side protocol bug.
all_projects = self.GetProjects(
args,
missing_ok=True,
submodules_ok=opt.fetch_submodules,
submodules_ok=opt.recurse_submodules,
manifest=manifest,
all_manifests=not opt.this_manifest_only,
)
@@ -2988,7 +3014,7 @@ later is required to fix a server side protocol bug.
project_list = self.GetProjects(
args,
missing_ok=True,
submodules_ok=opt.fetch_submodules,
submodules_ok=opt.recurse_submodules,
manifest=manifest,
all_manifests=not opt.this_manifest_only,
)