|
44 | 44 | from commitizen import out |
45 | 45 | from commitizen.bump import normalize_tag |
46 | 46 | from commitizen.cz.base import ChangelogReleaseHook |
| 47 | +from commitizen.defaults import get_tag_regexes |
47 | 48 | from commitizen.exceptions import InvalidConfigurationError, NoCommitsFoundError |
48 | 49 | from commitizen.git import GitCommit, GitTag |
49 | 50 | from commitizen.version_schemes import ( |
@@ -97,20 +98,7 @@ def get_version_tags( |
97 | 98 | scheme: type[BaseVersion], tags: list[GitTag], tag_format: str |
98 | 99 | ) -> list[GitTag]: |
99 | 100 | valid_tags: list[GitTag] = [] |
100 | | - TAG_FORMAT_REGEXS = { |
101 | | - "$version": scheme.parser.pattern, |
102 | | - "$major": r"(?P<major>\d+)", |
103 | | - "$minor": r"(?P<minor>\d+)", |
104 | | - "$patch": r"(?P<patch>\d+)", |
105 | | - "$prerelease": r"(?P<prerelease>\w+\d+)?", |
106 | | - "$devrelease": r"(?P<devrelease>\.dev\d+)?", |
107 | | - "${version}": scheme.parser.pattern, |
108 | | - "${major}": r"(?P<major>\d+)", |
109 | | - "${minor}": r"(?P<minor>\d+)", |
110 | | - "${patch}": r"(?P<patch>\d+)", |
111 | | - "${prerelease}": r"(?P<prerelease>\w+\d+)?", |
112 | | - "${devrelease}": r"(?P<devrelease>\.dev\d+)?", |
113 | | - } |
| 101 | + TAG_FORMAT_REGEXS = get_tag_regexes(scheme.parser.pattern) |
114 | 102 | tag_format_regex = tag_format |
115 | 103 | for pattern, regex in TAG_FORMAT_REGEXS.items(): |
116 | 104 | tag_format_regex = tag_format_regex.replace(pattern, regex) |
|
0 commit comments