From 7c0e78093bdaa72e8f6be078a80ac315a2761049 Mon Sep 17 00:00:00 2001 From: ellie Date: Sat, 30 Mar 2024 15:33:01 +0800 Subject: [PATCH 1/2] fix(command-init): "cz init" should list exisitng tag in reverse order --- commitizen/commands/init.py | 4 +++- tests/commands/test_init_command.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/commitizen/commands/init.py b/commitizen/commands/init.py index 62b3aec971..9775ec7fc8 100644 --- a/commitizen/commands/init.py +++ b/commitizen/commands/init.py @@ -186,9 +186,11 @@ def _ask_tag(self) -> str: out.error("No Existing Tag. Set tag to v0.0.1") return "0.0.1" + # the latest tag is most likely with the largest number. Thus list the tags in reverse order makes more sense + sorted_tags = sorted(tags, reverse=True) latest_tag = questionary.select( "Please choose the latest tag: ", - choices=tags, + choices=sorted_tags, style=self.cz.style, ).unsafe_ask() diff --git a/tests/commands/test_init_command.py b/tests/commands/test_init_command.py index ba77a12e3c..1814acb135 100644 --- a/tests/commands/test_init_command.py +++ b/tests/commands/test_init_command.py @@ -93,7 +93,7 @@ def test_init_when_config_already_exists(config, capsys): def test_init_without_choosing_tag(config, mocker: MockFixture, tmpdir): mocker.patch( - "commitizen.commands.init.get_tag_names", return_value=["0.0.1", "0.0.2"] + "commitizen.commands.init.get_tag_names", return_value=["0.0.2", "0.0.1"] ) mocker.patch("commitizen.commands.init.get_latest_tag_name", return_value="0.0.2") mocker.patch( From 223532b2782519b968cfa534b6dff4b3a102ce3a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 30 Mar 2024 08:03:21 +0000 Subject: [PATCH 2/2] =?UTF-8?q?bump:=20version=203.21.0=20=E2=86=92=203.21?= =?UTF-8?q?.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 2 +- CHANGELOG.md | 6 ++++++ commitizen/__version__.py | 2 +- pyproject.toml | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d66d4eb558..63c283e1c1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,7 +46,7 @@ repos: exclude: "poetry.lock" - repo: https://github.com/commitizen-tools/commitizen - rev: v3.21.0 # automatically updated by Commitizen + rev: v3.21.1 # automatically updated by Commitizen hooks: - id: commitizen - id: commitizen-branch diff --git a/CHANGELOG.md b/CHANGELOG.md index 83cb977b2c..ca27f0a2ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v3.21.1 (2024-03-30) + +### Fix + +- **command-init**: "cz init" should list exisitng tag in reverse order + ## v3.21.0 (2024-03-30) ### Feat diff --git a/commitizen/__version__.py b/commitizen/__version__.py index f87b7d84cf..ea92c23757 100644 --- a/commitizen/__version__.py +++ b/commitizen/__version__.py @@ -1 +1 @@ -__version__ = "3.21.0" +__version__ = "3.21.1" diff --git a/pyproject.toml b/pyproject.toml index 310c80eedc..4697401b98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.commitizen] -version = "3.21.0" +version = "3.21.1" tag_format = "v$version" version_files = [ "pyproject.toml:version", @@ -9,7 +9,7 @@ version_files = [ [tool.poetry] name = "commitizen" -version = "3.21.0" +version = "3.21.1" description = "Python commitizen client tool" authors = ["Santiago Fraire "] license = "MIT"