mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-10-18 03:17:22 +00:00
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:
1 parent
eeba6f268d
commit
dd1130352b
5 files changed
+82
-28
No files matched your search
@@ -34,17 +34,40 @@ from subcmds import sync
|
||||
"cli_args, expected",
|
||||
[
|
||||
([], None),
|
||||
(["--recurse-submodules"], True),
|
||||
(["--no-recurse-submodules"], False),
|
||||
(["--fetch-submodules"], True),
|
||||
(["--no-fetch-submodules"], False),
|
||||
],
|
||||
)
|
||||
def test_fetch_submodules_option(cli_args, expected):
|
||||
"""The fetch-submodules flags preserve an unset manifest-driven state."""
|
||||
def test_recurse_submodules_option(cli_args, expected):
|
||||
"""The submodule flags preserve an unset manifest-driven state."""
|
||||
cmd = sync.Sync()
|
||||
|
||||
opts, _ = cmd.OptionParser.parse_args(cli_args)
|
||||
|
||||
assert opts.fetch_submodules is expected
|
||||
assert opts.recurse_submodules is expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"old_flag, new_flag",
|
||||
[
|
||||
("--fetch-submodules", "--recurse-submodules"),
|
||||
("--no-fetch-submodules", "--no-recurse-submodules"),
|
||||
],
|
||||
)
|
||||
def test_recurse_submodules_option_deprecation(old_flag, new_flag):
|
||||
"""The old submodule flags warn and direct users to their replacements."""
|
||||
cmd = sync.Sync()
|
||||
|
||||
with mock.patch.object(sync.logger, "warning") as warning:
|
||||
cmd.OptionParser.parse_args([old_flag])
|
||||
|
||||
warning.assert_called_once_with(
|
||||
"%s is deprecated; use %s instead", old_flag, new_flag
|
||||
)
|
||||
|
||||
assert old_flag not in cmd.OptionParser.format_help()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
Reference in new issue
Block a user