@@ -66,9 +66,8 @@ def __init__(self, config: BaseConfig, arguments: dict):
6666 },
6767 }
6868 self .cz = factory .commiter_factory (self .config )
69- self .changelog = arguments ["changelog" ] or self .config .settings .get (
70- "update_changelog_on_bump"
71- )
69+ self .changelog_flag = arguments ["changelog" ]
70+ self .changelog_config = self .config .settings .get ("update_changelog_on_bump" )
7271 self .changelog_to_stdout = arguments ["changelog_to_stdout" ]
7372 self .git_output_to_stderr = arguments ["git_output_to_stderr" ]
7473 self .no_verify = arguments ["no_verify" ]
@@ -207,17 +206,24 @@ def __call__(self) -> None: # noqa: C901
207206 "--local-version cannot be combined with --build-metadata"
208207 )
209208
210- # If user specified changelog_to_stdout, they probably want the
211- # changelog to be generated as well, this is the most intuitive solution
212- self .changelog = self .changelog or bool (self .changelog_to_stdout )
213-
214209 if get_next :
215- if self .changelog :
210+ # if trying to use --get-next, we should not allow --changelog or --changelog-to-stdout
211+ if self .changelog_flag or bool (self .changelog_to_stdout ):
216212 raise NotAllowed (
217213 "--changelog or --changelog-to-stdout is not allowed with --get-next"
218214 )
215+ # --get-next is a special case, taking precedence over config for 'update_changelog_on_bump'
216+ self .changelog_config = False
219217 # Setting dry_run to prevent any unwanted changes to the repo or files
220218 self .dry_run = True
219+ else :
220+ # If user specified changelog_to_stdout, they probably want the
221+ # changelog to be generated as well, this is the most intuitive solution
222+ self .changelog_flag = (
223+ self .changelog_flag
224+ or bool (self .changelog_to_stdout )
225+ or self .changelog_config
226+ )
221227
222228 current_tag_version : str = bump .normalize_tag (
223229 current_version ,
@@ -309,7 +315,7 @@ def __call__(self) -> None: # noqa: C901
309315 )
310316
311317 files : list [str ] = []
312- if self .changelog :
318+ if self .changelog_flag :
313319 args = {
314320 "unreleased_version" : new_tag_version ,
315321 "template" : self .template ,
@@ -356,7 +362,9 @@ def __call__(self) -> None: # noqa: C901
356362 new_tag_version = new_tag_version ,
357363 message = message ,
358364 increment = increment ,
359- changelog_file_name = changelog_cmd .file_name if self .changelog else None ,
365+ changelog_file_name = changelog_cmd .file_name
366+ if self .changelog_flag
367+ else None ,
360368 )
361369
362370 if is_files_only :
@@ -365,7 +373,7 @@ def __call__(self) -> None: # noqa: C901
365373 # FIXME: check if any changes have been staged
366374 git .add (* files )
367375 c = git .commit (message , args = self ._get_commit_args ())
368- if self .retry and c .return_code != 0 and self .changelog :
376+ if self .retry and c .return_code != 0 and self .changelog_flag :
369377 # Maybe pre-commit reformatted some files? Retry once
370378 logger .debug ("1st git.commit error: %s" , c .err )
371379 logger .info ("1st commit attempt failed; retrying once" )
@@ -410,7 +418,9 @@ def __call__(self) -> None: # noqa: C901
410418 current_tag_version = new_tag_version ,
411419 message = message ,
412420 increment = increment ,
413- changelog_file_name = changelog_cmd .file_name if self .changelog else None ,
421+ changelog_file_name = changelog_cmd .file_name
422+ if self .changelog_flag
423+ else None ,
414424 )
415425
416426 # TODO: For v3 output this only as diagnostic and remove this if
0 commit comments