Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(commands/bump): prevent using incremental changelog when it is set to false in config #996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
josix wants to merge 2 commits into commitizen-tools:master
base: master
Choose a base branch
Loading
from josix:fix/changelog-default-changelog-incremental
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions commitizen/commands/bump.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ def __call__(self) -> None: # noqa: C901
"unreleased_version": new_tag_version,
"template": self.template,
"extras": self.extras,
"incremental": True,
"incremental": self.config.mutated_settings.get(
"changelog_incremental", True
),
"dry_run": True,
},
)
Expand All @@ -305,7 +307,9 @@ def __call__(self) -> None: # noqa: C901
self.config,
{
"unreleased_version": new_tag_version,
"incremental": True,
"incremental": self.config.mutated_settings.get(
"changelog_incremental", True
),
"dry_run": dry_run,
"template": self.template,
"extras": self.extras,
Expand Down
10 changes: 10 additions & 0 deletions commitizen/config/base_config.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ def __init__(self):
self._settings: Settings = DEFAULT_SETTINGS.copy()
self.encoding = self.settings["encoding"]
self._path: Path | None = None
self._settings_from_configs: Settings = {}

@property
def settings(self) -> Settings:
return self._settings

@property
def mutated_settings(self) -> Settings:
"""It is used to record the changes from the config file defined by users,
which helps distinguish the ambiguous default behavior of
`changelog_incremental`.
Please refer to https://github.com/commitizen-tools/commitizen/pull/996
"""
return self._settings_from_configs

@property
def path(self) -> Path | None:
return self._path
Expand Down
1 change: 1 addition & 0 deletions commitizen/config/json_config.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ def _parse_setting(self, data: bytes | str) -> None:

try:
self.settings.update(doc["commitizen"])
self.mutated_settings.update(doc["commitizen"])
except KeyError:
self.is_empty_config = True
1 change: 1 addition & 0 deletions commitizen/config/toml_config.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ def _parse_setting(self, data: bytes | str) -> None:

try:
self.settings.update(doc["tool"]["commitizen"]) # type: ignore
self.mutated_settings.update(doc["tool"]["commitizen"]) # type: ignore
except exceptions.NonExistentKey:
self.is_empty_config = True
1 change: 1 addition & 0 deletions commitizen/config/yaml_config.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def _parse_setting(self, data: bytes | str) -> None:

try:
self.settings.update(doc["commitizen"])
self.mutated_settings.update(doc["commitizen"])
except (KeyError, TypeError):
self.is_empty_config = True

Expand Down

AltStyle によって変換されたページ (->オリジナル) /