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
@@ -95,7 +94,6 @@ def __init__(self, config: BaseConfig, arguments: BumpArgs) -> None:
9594 )
9695 self .cz = factory .committer_factory (self .config )
9796 self .changelog_flag = arguments ["changelog" ]
98- self .changelog_config = self .config .settings .get ("update_changelog_on_bump" )
9997 self .changelog_to_stdout = arguments ["changelog_to_stdout" ]
10098 self .git_output_to_stderr = arguments ["git_output_to_stderr" ]
10199 self .no_verify = arguments ["no_verify" ]
@@ -170,7 +168,9 @@ def __call__(self) -> None:
170168 is_local_version = self .arguments ["local_version" ]
171169 manual_version = self .arguments ["manual_version" ]
172170 build_metadata = self .arguments ["build_metadata" ]
173- get_next = self .arguments ["get_next" ]
171+ next_version_to_stdout = self .arguments [
172+ "get_next"
173+ ] # TODO: maybe rename to `next_version_to_stdout`
174174 allow_no_commit = self .arguments ["allow_no_commit" ]
175175 major_version_zero = self .arguments ["major_version_zero" ]
176176
@@ -182,7 +182,6 @@ def __call__(self) -> None:
182182 (is_local_version , "--local-version" ),
183183 (build_metadata , "--build-metadata" ),
184184 (major_version_zero , "--major-version-zero" ),
185- (get_next , "--get-next" ),
186185 ):
187186 if val :
188187 raise NotAllowed (f"{ option } cannot be combined with MANUAL_VERSION" )
@@ -195,24 +194,23 @@ def __call__(self) -> None:
195194 if build_metadata and is_local_version :
196195 raise NotAllowed ("--local-version cannot be combined with --build-metadata" )
197196
198- if get_next :
197+ if next_version_to_stdout :
199198 for value , option in (
200199 (self .changelog_flag , "--changelog" ),
201200 (self .changelog_to_stdout , "--changelog-to-stdout" ),
202201 ):
203202 if value :
204- raise NotAllowed (f"{ option } cannot be combined with --get-next" )
205-
206- # --get-next is a special case, taking precedence over config for 'update_changelog_on_bump'
207- self .changelog_config = False
208- # Setting dry_run to prevent any unwanted changes to the repo or files
209- self .dry_run = True
210- else :
211- # If user specified changelog_to_stdout, they probably want the
212- # changelog to be generated as well, this is the most intuitive solution
213- self .changelog_flag = any (
214- (self .changelog_flag , self .changelog_to_stdout , self .changelog_config )
203+ warnings .warn (f"{ option } has no effect when used with --get-next" )
204+
205+ # If user specified changelog_to_stdout, they probably want the
206+ # changelog to be generated as well, this is the most intuitive solution
207+ self .changelog_flag = any (
208+ (
209+ self .changelog_flag ,
210+ self .changelog_to_stdout ,
211+ self .config .settings .get ("update_changelog_on_bump" ),
215212 )
213+ )
216214
217215 rules = TagRules .from_settings (cast (Settings , self .bump_settings ))
218216 current_tag = rules .find_tag_for (git .get_tags (), current_version )
@@ -271,20 +269,18 @@ def __call__(self) -> None:
271269 )
272270
273271 new_tag_version = rules .normalize_tag (new_version )
274- message = bump .create_commit_message (
275- current_version , new_version , self .bump_settings ["bump_message" ]
276- )
277-
278- if get_next :
272+ if next_version_to_stdout :
279273 if increment is None and new_tag_version == current_tag_version :
280274 raise NoneIncrementExit (
281275 "[NO_COMMITS_TO_BUMP]\n "
282276 "The commits found are not eligible to be bumped"
283277 )
284-
285278 out .write (str (new_version ))
286- raise GetNextExit ()
279+ raise DryRunExit ()
287280
281+ message = bump .create_commit_message (
282+ current_version , new_version , self .bump_settings ["bump_message" ]
283+ )
288284 # Report found information
289285 information = f"{ message } \n tag to create: { new_tag_version } \n "
290286 if increment :
0 commit comments