1616 BumpTagFailedError ,
1717 DryRunExit ,
1818 ExpectedExit ,
19- GetNextExit ,
2019 InvalidManualVersion ,
2120 NoCommitsFoundError ,
2221 NoneIncrementExit ,
@@ -47,7 +46,7 @@ class BumpArgs(Settings, total=False):
4746 dry_run : bool
4847 file_name : str
4948 files_only : bool | None
50- get_next : bool
49+ get_next : bool # TODO: maybe rename to `next_version_to_stdout`
5150 git_output_to_stderr : bool
5251 increment_mode : str
5352 increment : Increment | None
@@ -94,7 +93,6 @@ def __init__(self, config: BaseConfig, arguments: BumpArgs) -> None:
9493 )
9594 self .cz = factory .committer_factory (self .config )
9695 self .changelog_flag = arguments ["changelog" ]
97- self .changelog_config = self .config .settings .get ("update_changelog_on_bump" )
9896 self .changelog_to_stdout = arguments ["changelog_to_stdout" ]
9997 self .git_output_to_stderr = arguments ["git_output_to_stderr" ]
10098 self .no_verify = arguments ["no_verify" ]
@@ -169,7 +167,9 @@ def __call__(self) -> None:
169167 is_local_version = self .arguments ["local_version" ]
170168 manual_version = self .arguments ["manual_version" ]
171169 build_metadata = self .arguments ["build_metadata" ]
172- get_next = self .arguments ["get_next" ]
170+ next_version_to_stdout = self .arguments [
171+ "get_next"
172+ ] # TODO: maybe rename to `next_version_to_stdout`
173173 allow_no_commit = self .arguments ["allow_no_commit" ]
174174 major_version_zero = self .arguments ["major_version_zero" ]
175175
@@ -181,7 +181,6 @@ def __call__(self) -> None:
181181 (is_local_version , "--local-version" ),
182182 (build_metadata , "--build-metadata" ),
183183 (major_version_zero , "--major-version-zero" ),
184- (get_next , "--get-next" ),
185184 ):
186185 if val :
187186 raise NotAllowed (f"{ option } cannot be combined with MANUAL_VERSION" )
@@ -194,24 +193,23 @@ def __call__(self) -> None:
194193 if build_metadata and is_local_version :
195194 raise NotAllowed ("--local-version cannot be combined with --build-metadata" )
196195
197- if get_next :
196+ if next_version_to_stdout :
198197 for value , option in (
199198 (self .changelog_flag , "--changelog" ),
200199 (self .changelog_to_stdout , "--changelog-to-stdout" ),
201200 ):
202201 if value :
203- raise NotAllowed (f"{ option } cannot be combined with --get-next" )
204-
205- # --get-next is a special case, taking precedence over config for 'update_changelog_on_bump'
206- self .changelog_config = False
207- # Setting dry_run to prevent any unwanted changes to the repo or files
208- self .dry_run = True
209- else :
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_flag = any (
213- (self .changelog_flag , self .changelog_to_stdout , self .changelog_config )
202+ warnings .warn (f"{ option } has no effect when used with --get-next" )
203+
204+ # If user specified changelog_to_stdout, they probably want the
205+ # changelog to be generated as well, this is the most intuitive solution
206+ self .changelog_flag = any (
207+ (
208+ self .changelog_flag ,
209+ self .changelog_to_stdout ,
210+ self .config .settings .get ("update_changelog_on_bump" ),
214211 )
212+ )
215213
216214 rules = TagRules .from_settings (cast (Settings , self .bump_settings ))
217215 current_tag = rules .find_tag_for (git .get_tags (), current_version )
@@ -270,20 +268,18 @@ def __call__(self) -> None:
270268 )
271269
272270 new_tag_version = rules .normalize_tag (new_version )
273- message = bump .create_commit_message (
274- current_version , new_version , self .bump_settings ["bump_message" ]
275- )
276-
277- if get_next :
271+ if next_version_to_stdout :
278272 if increment is None and new_tag_version == current_tag_version :
279273 raise NoneIncrementExit (
280274 "[NO_COMMITS_TO_BUMP]\n "
281275 "The commits found are not eligible to be bumped"
282276 )
283-
284277 out .write (str (new_version ))
285- raise GetNextExit ()
278+ raise DryRunExit ()
286279
280+ message = bump .create_commit_message (
281+ current_version , new_version , self .bump_settings ["bump_message" ]
282+ )
287283 # Report found information
288284 information = f"{ message } \n tag to create: { new_tag_version } \n "
289285 if increment :
@@ -302,8 +298,8 @@ def __call__(self) -> None:
302298 "[NO_COMMITS_TO_BUMP]\n The commits found are not eligible to be bumped"
303299 )
304300
305- files : list [str ] = []
306301 dry_run = self .arguments ["dry_run" ]
302+ files : list [str ] = []
307303 if self .changelog_flag :
308304 args = {
309305 "unreleased_version" : new_tag_version ,
0 commit comments