MCPcopy Create free account
hub / github.com/commitizen-tools/commitizen / get_version

Method get_version

commitizen/providers/scm_provider.py:17–28  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

15 """
16
17 def get_version(self) -> str:
18 rules = TagRules.from_settings(self.config.settings)
19 tags = get_tags(reachable_only=True)
20 version_tags = rules.get_version_tags(tags)
21 # Floating tags (e.g. `v1.0` next to `v1.0.0`) compare equal. Among equal
22 # versions, prefer the most specific (longest) spelling.
23 version = max(
24 (rules.extract_version(t) for t in version_tags),
25 key=lambda v: (v, len(str(v))),
26 default=None,
27 )
28 return str(version) if version is not None else "0.0.0"
29
30 def set_version(self, version: str) -> None:
31 # Not necessary

Calls 4

get_tagsFunction · 0.90
from_settingsMethod · 0.80
get_version_tagsMethod · 0.80
extract_versionMethod · 0.80