Skip to content

Commit 45b9352

Browse files
committed
fix(commands/bump): prevent using incremental changelog when it is set to false in config
1 parent fc54b51 commit 45b9352

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

commitizen/commands/bump.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ def __call__(self) -> None: # noqa: C901
293293
"unreleased_version": new_tag_version,
294294
"template": self.template,
295295
"extras": self.extras,
296-
"incremental": True,
296+
"incremental": self.config.mutated_settings.get(
297+
"changelog_incremental", True
298+
),
297299
"dry_run": True,
298300
},
299301
)
@@ -305,7 +307,9 @@ def __call__(self) -> None: # noqa: C901
305307
self.config,
306308
{
307309
"unreleased_version": new_tag_version,
308-
"incremental": True,
310+
"incremental": self.config.mutated_settings.get(
311+
"changelog_incremental", True
312+
),
309313
"dry_run": dry_run,
310314
"template": self.template,
311315
"extras": self.extras,

commitizen/config/base_config.py

+5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ def __init__(self):
1010
self._settings: Settings = DEFAULT_SETTINGS.copy()
1111
self.encoding = self.settings["encoding"]
1212
self._path: Path | None = None
13+
self._settings_from_configs: Settings = {}
1314

1415
@property
1516
def settings(self) -> Settings:
1617
return self._settings
1718

19+
@property
20+
def mutated_settings(self) -> Settings:
21+
return self._settings_from_configs
22+
1823
@property
1924
def path(self) -> Path | None:
2025
return self._path

commitizen/config/json_config.py

+1
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,6 @@ def _parse_setting(self, data: bytes | str) -> None:
5252

5353
try:
5454
self.settings.update(doc["commitizen"])
55+
self.mutated_settings.update(doc["commitizen"])
5556
except KeyError:
5657
self.is_empty_config = True

commitizen/config/toml_config.py

+1
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@ def _parse_setting(self, data: bytes | str) -> None:
5858

5959
try:
6060
self.settings.update(doc["tool"]["commitizen"]) # type: ignore
61+
self.mutated_settings.update(doc["tool"]["commitizen"]) # type: ignore
6162
except exceptions.NonExistentKey:
6263
self.is_empty_config = True

commitizen/config/yaml_config.py

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def _parse_setting(self, data: bytes | str) -> None:
3838

3939
try:
4040
self.settings.update(doc["commitizen"])
41+
self.mutated_settings.update(doc["commitizen"])
4142
except (KeyError, TypeError):
4243
self.is_empty_config = True
4344

0 commit comments

Comments
 (0)