From 8f19b24e3e1c589ac0192705f63a7197e8891ed5 Mon Sep 17 00:00:00 2001 From: Jannis Mattheis Date: Mon, 26 Jun 2023 16:19:53 +0200 Subject: [PATCH] fix(bump): add bump support with custom type + scope + exclamation mark The regex didn't match the following commit with exclamation mark, and therefore didn't update the version. chore(deps)!: drop support for Python 3.9 The regex was simplified, because a lot groups were not needed. --- commitizen/defaults.py | 2 +- tests/test_bump_find_increment.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/commitizen/defaults.py b/commitizen/defaults.py index a243ebda3..d92271727 100644 --- a/commitizen/defaults.py +++ b/commitizen/defaults.py @@ -104,7 +104,7 @@ class Settings(TypedDict, total=False): MINOR = "MINOR" PATCH = "PATCH" -bump_pattern = r"^(((BREAKING[\-\ ]CHANGE|feat|fix|refactor|perf)(\(.+\))?(!)?)|\w+!):" +bump_pattern = r"^((BREAKING[\-\ ]CHANGE|\w+)(\(.+\))?!?):" bump_map = OrderedDict( ( (r"^.+!$", MAJOR), diff --git a/tests/test_bump_find_increment.py b/tests/test_bump_find_increment.py index 337cf17e7..8e8fc2705 100644 --- a/tests/test_bump_find_increment.py +++ b/tests/test_bump_find_increment.py @@ -58,6 +58,12 @@ "fix(setup.py): future is now required for every python version", ] +MAJOR_INCREMENTS_EXCLAMATION_OTHER_TYPE_WITH_SCOPE_CC = [ + "chore(deps)!: drop support for Python 3.9", + "docs(README): motivation", + "fix(setup.py): future is now required for every python version", +] + PATCH_INCREMENTS_SVE = ["readme motivation PATCH", "fix setup.py PATCH"] MINOR_INCREMENTS_SVE = [ @@ -85,6 +91,7 @@ (MAJOR_INCREMENTS_BREAKING_CHANGE_CC, "MAJOR"), (MAJOR_INCREMENTS_BREAKING_CHANGE_ALT_CC, "MAJOR"), (MAJOR_INCREMENTS_EXCLAMATION_OTHER_TYPE_CC, "MAJOR"), + (MAJOR_INCREMENTS_EXCLAMATION_OTHER_TYPE_WITH_SCOPE_CC, "MAJOR"), (MAJOR_INCREMENTS_EXCLAMATION_CC, "MAJOR"), (MAJOR_INCREMENTS_EXCLAMATION_CC_SAMPLE_2, "MAJOR"), (NONE_INCREMENT_CC, None),