MCPcopy Index your code
hub / github.com/commitizen-tools/commitizen / __call__

Method __call__

commitizen/commands/bump.py:241–440  ·  view source on GitHub ↗

Steps executed to bump.

(self)

Source from the content-addressed store, hash-verified

239 )
240
241 def __call__(self) -> None:
242 """Steps executed to bump."""
243 provider = get_provider(self.config)
244 current_version = self.scheme(provider.get_version())
245 self._validate_arguments(current_version)
246
247 next_version_to_stdout = self.arguments["get_next"]
248 if next_version_to_stdout:
249 for value, option in (
250 (self.changelog_flag, "--changelog"),
251 (self.changelog_to_stdout, "--changelog-to-stdout"),
252 ):
253 if value:
254 warnings.warn(f"{option} has no effect when used with --get-next")
255
256 # If user specified changelog_to_stdout, they probably want the
257 # changelog to be generated as well, this is the most intuitive solution
258 self.changelog_flag = any(
259 (
260 self.changelog_flag,
261 self.changelog_to_stdout,
262 self.config.settings.get("update_changelog_on_bump"),
263 )
264 )
265
266 rules = TagRules.from_settings(cast("Settings", self.bump_settings))
267 current_tag = rules.find_tag_for(git.get_tags(), current_version)
268 current_tag_version = (
269 current_tag.name if current_tag else rules.normalize_tag(current_version)
270 )
271
272 is_initial = self._is_initial_tag(current_tag, self.arguments["yes"])
273
274 increment, new_version = self._resolve_increment_and_new_version(
275 current_version, current_tag
276 )
277
278 new_tag_version = rules.normalize_tag(new_version)
279 if next_version_to_stdout:
280 if increment is None and new_tag_version == current_tag_version:
281 raise NoneIncrementExit(
282 "[NO_COMMITS_TO_BUMP]\n"
283 "The commits found are not eligible to be bumped"
284 )
285 out.write(str(new_version))
286 raise DryRunExit()
287
288 message = bump.create_commit_message(
289 current_version, new_version, self.bump_settings["bump_message"]
290 )
291 # Report found information
292 information = f"{message}\ntag to create: {new_tag_version}\n"
293 if increment:
294 information += f"increment detected: {increment}\n"
295
296 if self.changelog_to_stdout:
297 # When the changelog goes to stdout, we want to send
298 # the bump information to stderr, this way the

Callers

nothing calls this directly

Calls 15

_validate_argumentsMethod · 0.95
_is_initial_tagMethod · 0.95
_get_commit_argsMethod · 0.95
get_providerFunction · 0.90
NoneIncrementExitClass · 0.90
DryRunExitClass · 0.90
ChangelogClass · 0.90
ExpectedExitClass · 0.90
BumpTagFailedErrorClass · 0.90
from_settingsMethod · 0.80

Tested by

no test coverage detected