From faef24eb498437d29ff0ae0c0097d19e20bfe9fc Mon Sep 17 00:00:00 2001 From: Yu-Ting Hsiung Date: Mon, 2 Jun 2025 00:11:57 +0800 Subject: [PATCH 1/2] fix(commit): emit deprecated warning of cz commit -s --- commitizen/commands/commit.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/commitizen/commands/commit.py b/commitizen/commands/commit.py index 43feb272b..bb4c2fdc9 100644 --- a/commitizen/commands/commit.py +++ b/commitizen/commands/commit.py @@ -125,6 +125,11 @@ def __call__(self) -> None: write_message_to_file = self.arguments.get("write_message_to_file") signoff = bool(self.arguments.get("signoff")) + if signoff: + out.warn( + "Deprecated warning: `cz commit -s` is deprecated and will be removed in v5, please use `cz commit -- -s` instead." + ) + if self.arguments.get("all"): git.add("-u") @@ -147,11 +152,6 @@ def __call__(self) -> None: if dry_run: raise DryRunExit() - if signoff: - out.warn( - "signoff mechanic is deprecated, please use `cz commit -- -s` instead." - ) - if self.config.settings["always_signoff"] or signoff: extra_args = f"{extra_args} -s".strip() From c31dfc292f6a4a41e94503d3221f29741bb803e7 Mon Sep 17 00:00:00 2001 From: Yu-Ting Hsiung Date: Mon, 2 Jun 2025 00:26:32 +0800 Subject: [PATCH 2/2] fix(cli): update description for deprecate warning Closes #1135 --- commitizen/cli.py | 4 ++-- ...st_bump_command_shows_description_when_use_help_option.txt | 2 +- ..._commit_command_shows_description_when_use_help_option.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commitizen/cli.py b/commitizen/cli.py index 12db01711..6f7556df4 100644 --- a/commitizen/cli.py +++ b/commitizen/cli.py @@ -147,7 +147,7 @@ def __call__( { "name": ["-s", "--signoff"], "action": "store_true", - "help": "sign off the commit", + "help": "Deprecated, use 'cz commit -- -s' instead", }, { "name": ["-a", "--all"], @@ -347,7 +347,7 @@ def __call__( }, { "name": ["--version-type"], - "help": "Deprecated, use --version-scheme", + "help": "Deprecated, use --version-scheme instead", "default": None, "choices": version_schemes.KNOWN_SCHEMES, }, diff --git a/tests/commands/test_bump_command/test_bump_command_shows_description_when_use_help_option.txt b/tests/commands/test_bump_command/test_bump_command_shows_description_when_use_help_option.txt index 5d4438875..4cf8e6c91 100644 --- a/tests/commands/test_bump_command/test_bump_command_shows_description_when_use_help_option.txt +++ b/tests/commands/test_bump_command/test_bump_command_shows_description_when_use_help_option.txt @@ -74,7 +74,7 @@ options: --version-scheme {pep440,semver,semver2} choose version scheme --version-type {pep440,semver,semver2} - Deprecated, use --version-scheme + Deprecated, use --version-scheme instead --build-metadata BUILD_METADATA Add additional build-metadata to the version-number --get-next Determine the next version and write to stdout diff --git a/tests/commands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt b/tests/commands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt index dd1f53f3d..ba531042a 100644 --- a/tests/commands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt +++ b/tests/commands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt @@ -12,7 +12,7 @@ options: --write-message-to-file FILE_PATH write message to file before committing (can be combined with --dry-run) - -s, --signoff sign off the commit + -s, --signoff Deprecated, use 'cz commit -- -s' instead -a, --all Tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected.