Skip to content

Commit 6b7807e

Browse files
author
Serpa
authored
Merge pull request #3 from engineai-dev/fix-monorepo
2 parents 3b854a7 + 2f2f9f4 commit 6b7807e

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

commitizen/changelog.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ def tag_included_in_changelog(
9090
return True
9191

9292

93-
def get_version_tags(scheme: type[BaseVersion], tags: list[GitTag]) -> list[GitTag]:
93+
def get_version_tags(scheme: type[BaseVersion], tags: list[GitTag], prefix: str = "") -> list[GitTag]:
9494
valid_tags: list[GitTag] = []
9595
for tag in tags:
9696
try:
97-
scheme(tag.name)
98-
except InvalidVersion:
99-
out.warn(f"InvalidVersion {tag}")
97+
scheme(tag.name.replace(prefix, ''))
98+
except InvalidVersion as e:
99+
out.warn(f"InvalidVersion hey {tag}")
100100
else:
101101
valid_tags.append(tag)
102102

commitizen/defaults.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Settings(TypedDict, total=False):
3636
version_scheme: str | None
3737
version_type: str | None
3838
tag_format: str
39+
tag_prefix: str | None
3940
bump_message: str | None
4041
allow_abort: bool
4142
allowed_prefixes: list[str]
@@ -76,6 +77,7 @@ class Settings(TypedDict, total=False):
7677
"version_provider": "commitizen",
7778
"version_scheme": None,
7879
"tag_format": "$version", # example v$version
80+
"tag_prefix": "",
7981
"bump_message": None, # bumped v$current_version to $new_version
8082
"allow_abort": False,
8183
"allowed_prefixes": [

commitizen/git.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def get_filenames_in_commit(git_reference: str = ""):
158158
raise GitCommandError(c.err)
159159

160160

161-
def get_tags(dateformat: str = "%Y-%m-%d") -> list[GitTag]:
161+
def get_tags(prefix: str, dateformat: str = "%Y-%m-%d") -> list[GitTag]:
162162
inner_delimiter = "---inner_delimiter---"
163163
formatter = (
164164
f'"%(refname:lstrip=2){inner_delimiter}'
@@ -181,6 +181,9 @@ def get_tags(dateformat: str = "%Y-%m-%d") -> list[GitTag]:
181181
for line in c.out.split("\n")[:-1]
182182
]
183183

184+
if prefix:
185+
git_tags = [tag for tag in git_tags if tag.name.startswith(prefix)]
186+
184187
return git_tags
185188

186189

0 commit comments

Comments
 (0)