Skip to content

Commit ca6dad2

Browse files
bjoernricksgreenbonebot
authored andcommitted
Change: Always use the same git tag prefix
Introduce a variable for the default git tag prefix and use it for the release create command.
1 parent c26a4c8 commit ca6dad2

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

pontos/git/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#
55

66
from ._git import (
7+
DEFAULT_TAG_PREFIX,
78
DEFAULT_TAG_SORT_SUFFIX,
89
ConfigScope,
910
Git,
@@ -16,6 +17,7 @@
1617

1718
__all__ = (
1819
"DEFAULT_TAG_SORT_SUFFIX",
20+
"DEFAULT_TAG_PREFIX",
1921
"ConfigScope",
2022
"Git",
2123
"GitError",

pontos/git/_git.py

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
"rc",
3030
]
3131

32+
DEFAULT_TAG_PREFIX = "v"
33+
3234

3335
class GitError(subprocess.CalledProcessError, PontosError):
3436
"""

pontos/release/_parser.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import shtab
1818

1919
from pontos.enum import enum_choice, enum_type, to_choices
20+
from pontos.git._git import DEFAULT_TAG_PREFIX
2021
from pontos.version.schemes import (
2122
VERSIONING_SCHEMES,
2223
PEP440VersioningScheme,
@@ -115,7 +116,7 @@ def add_create_parser(
115116
)
116117
create_parser.add_argument(
117118
"--git-tag-prefix",
118-
default="v",
119+
default=DEFAULT_TAG_PREFIX,
119120
const="",
120121
nargs="?",
121122
help="Prefix for git tag versions. Default: %(default)s",

pontos/release/create.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from pontos.changelog.conventional_commits import ChangelogBuilder
1515
from pontos.errors import PontosError
1616
from pontos.git import Git, ResetMode
17+
from pontos.git._git import DEFAULT_TAG_PREFIX
1718
from pontos.github.actions.core import ActionIO
1819
from pontos.github.api import GitHubAsyncRESTApi
1920
from pontos.release.command import AsyncCommand
@@ -133,7 +134,7 @@ async def async_run( # type: ignore[override]
133134
next_version: Union[Version, Literal[False], None],
134135
git_signing_key: str,
135136
git_remote_name: Optional[str],
136-
git_tag_prefix: Optional[str],
137+
git_tag_prefix: Optional[str] = DEFAULT_TAG_PREFIX,
137138
cc_config: Optional[Path],
138139
local: Optional[bool] = False,
139140
release_series: Optional[str] = None,

0 commit comments

Comments
 (0)