|
5 | 5 | import questionary
|
6 | 6 | from packaging.version import InvalidVersion, Version
|
7 | 7 |
|
8 |
| -from commitizen import bump, cmd, defaults, factory, git, hooks, out, version_types |
| 8 | +from commitizen import bump, cmd, factory, git, hooks, out, version_types |
9 | 9 | from commitizen.commands.changelog import Changelog
|
10 | 10 | from commitizen.config import BaseConfig
|
11 | 11 | from commitizen.exceptions import (
|
@@ -86,8 +86,16 @@ def is_initial_tag(self, current_tag_version: str, is_yes: bool = False) -> bool
|
86 | 86 | return is_initial
|
87 | 87 |
|
88 | 88 | def find_increment(self, commits: List[git.GitCommit]) -> Optional[str]:
|
| 89 | + # Update the bump map to ensure major version doesn't increment. |
| 90 | + is_major_version_zero: bool = self.bump_settings["major_version_zero"] |
| 91 | + # self.cz.bump_map = defaults.bump_map_major_version_zero |
| 92 | + bump_map = ( |
| 93 | + self.cz.bump_map_major_version_zero |
| 94 | + if is_major_version_zero |
| 95 | + else self.cz.bump_map |
| 96 | + ) |
89 | 97 | bump_pattern = self.cz.bump_pattern
|
90 |
| - bump_map = self.cz.bump_map |
| 98 | + |
91 | 99 | if not bump_map or not bump_pattern:
|
92 | 100 | raise NoPatternMapError(
|
93 | 101 | f"'{self.config.settings['name']}' rule does not support bump"
|
@@ -153,9 +161,6 @@ def __call__(self): # noqa: C901
|
153 | 161 | f"--major-version-zero is meaningless for current version {current_version}"
|
154 | 162 | )
|
155 | 163 |
|
156 |
| - # Update the bump map to ensure major version doesn't increment. |
157 |
| - self.cz.bump_map = defaults.bump_map_major_version_zero |
158 |
| - |
159 | 164 | current_tag_version: str = bump.normalize_tag(
|
160 | 165 | current_version,
|
161 | 166 | tag_format=tag_format,
|
|
0 commit comments