Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cbb2527f4e | |||
| 490bc400cb | |||
| 00882db033 | |||
|
|
5dc86907b6 | ||
|
|
ce7d23f44b | ||
| eb5bbc2900 | |||
|
|
deb9b618d1 |
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@@ -184,7 +184,7 @@ pipeline {
|
|||||||
sh("virtualenv --pip=embed --setuptools=embed --wheel=embed --no-periodic-update --activators bash,python TOOLS_ENV")
|
sh("virtualenv --pip=embed --setuptools=embed --wheel=embed --no-periodic-update --activators bash,python TOOLS_ENV")
|
||||||
|
|
||||||
sh(". ~/BUILD_ENV/bin/activate && pip install --upgrade setuptools build pip")
|
sh(". ~/BUILD_ENV/bin/activate && pip install --upgrade setuptools build pip")
|
||||||
sh(". ~/BUILD_ENV/bin/activate && pip install --upgrade 'copier==8.*' jinja2-slug toml")
|
sh(". ~/BUILD_ENV/bin/activate && pip install --upgrade 'copier==9.*' jinja2-slug toml")
|
||||||
|
|
||||||
sh(". ~/TEST_ENV/bin/activate && pip install --upgrade pip")
|
sh(". ~/TEST_ENV/bin/activate && pip install --upgrade pip")
|
||||||
|
|
||||||
@@ -426,9 +426,17 @@ pipeline {
|
|||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
dir("gitrepo") {
|
dir("gitrepo") {
|
||||||
publishCoverage adapters: [cobertura(mergeToOneReport: true, path: "helpers-results/cl_types_check/cobertura.xml")]
|
//publish coverage
|
||||||
junit 'helpers-results/cl_types_check/junit.xml'
|
recordCoverage( sourceDirectories: [[path: 'src']],
|
||||||
|
tools: [[parser: 'COBERTURA', pattern: 'helpers-results/cl_types_check/cobertura.xml']],
|
||||||
|
id: 'COBERTURA', name: 'COBERTURA Coverage',
|
||||||
|
sourceCodeRetention: 'EVERY_BUILD',)
|
||||||
|
|
||||||
|
//add type check to junit result set
|
||||||
|
junit 'helpers-results/cl_types_check/junit.xml'
|
||||||
|
|
||||||
|
//publish html reports files
|
||||||
publishHTML([
|
publishHTML([
|
||||||
reportDir: "helpers-results/cl_quality_check",
|
reportDir: "helpers-results/cl_quality_check",
|
||||||
reportFiles: "report.html",
|
reportFiles: "report.html",
|
||||||
@@ -538,7 +546,7 @@ pipeline {
|
|||||||
dir("gitrepo") {
|
dir("gitrepo") {
|
||||||
junit 'helpers-results/cl_unit_test/*.xml'
|
junit 'helpers-results/cl_unit_test/*.xml'
|
||||||
// using cobertura format (= coverage xml format)
|
// using cobertura format (= coverage xml format)
|
||||||
publishCoverage adapters: [cobertura(mergeToOneReport: true, path: "helpers-results/cl_unit_test_coverage/test_coverage.xml")]
|
recordCoverage(tools: [[parser: 'COBERTURA', pattern: 'helpers-results/cl_unit_test_coverage/test_coverage.xml']])
|
||||||
publishHTML([
|
publishHTML([
|
||||||
reportDir: "helpers-results/cl_unit_test_coverage",
|
reportDir: "helpers-results/cl_unit_test_coverage",
|
||||||
reportFiles: "index.html",
|
reportFiles: "index.html",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<stringAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING" value="UTF-8"/>
|
<stringAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING" value="UTF-8"/>
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:pygitversionhelper/helpers_proxy}"/>
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:pygitversionhelper/helpers_proxy}"/>
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_OTHER_WORKING_DIRECTORY" value=""/>
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_OTHER_WORKING_DIRECTORY" value=""/>
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="--typecheck --qualitycheck"/>
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="--qualitycheck"/>
|
||||||
<stringAttribute key="org.python.pydev.debug.ATTR_INTERPRETER" value="__default"/>
|
<stringAttribute key="org.python.pydev.debug.ATTR_INTERPRETER" value="__default"/>
|
||||||
<stringAttribute key="org.python.pydev.debug.ATTR_PROJECT" value="pygitversionhelper"/>
|
<stringAttribute key="org.python.pydev.debug.ATTR_PROJECT" value="pygitversionhelper"/>
|
||||||
<stringAttribute key="process_factory_id" value="org.python.pydev.debug.processfactory.PyProcessFactory"/>
|
<stringAttribute key="process_factory_id" value="org.python.pydev.debug.processfactory.PyProcessFactory"/>
|
||||||
|
|||||||
17
RUN_types.launch
Normal file
17
RUN_types.launch
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<launchConfiguration type="org.python.pydev.debug.regularLaunchConfigurationType">
|
||||||
|
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
|
||||||
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||||
|
<listEntry value="/pygitversionhelper/helpers_proxy"/>
|
||||||
|
</listAttribute>
|
||||||
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||||
|
<listEntry value="2"/>
|
||||||
|
</listAttribute>
|
||||||
|
<stringAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING" value="UTF-8"/>
|
||||||
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:pygitversionhelper/helpers_proxy}"/>
|
||||||
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_OTHER_WORKING_DIRECTORY" value=""/>
|
||||||
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="--typecheck"/>
|
||||||
|
<stringAttribute key="org.python.pydev.debug.ATTR_INTERPRETER" value="__default"/>
|
||||||
|
<stringAttribute key="org.python.pydev.debug.ATTR_PROJECT" value="pygitversionhelper"/>
|
||||||
|
<stringAttribute key="process_factory_id" value="org.python.pydev.debug.processfactory.PyProcessFactory"/>
|
||||||
|
</launchConfiguration>
|
||||||
@@ -46,7 +46,21 @@ include-package-data = true
|
|||||||
where = ["src"]
|
where = ["src"]
|
||||||
|
|
||||||
[tool.setuptools.package-data]
|
[tool.setuptools.package-data]
|
||||||
"pygitversionhelper.data" = ["*.*"]
|
"pysimpleini" = ["py.typed"]
|
||||||
|
|
||||||
|
# [[tool.mypy.overrides]]
|
||||||
|
# module = ""
|
||||||
|
# ignore_missing_imports = true
|
||||||
|
|
||||||
|
[tool.coverage.run]
|
||||||
|
cover_pylib = false
|
||||||
|
branch = true
|
||||||
|
data_file="helpers-results/cl_unit_test_raw_coverage/.coverage"
|
||||||
|
# debug = ["config","multiproc","process"]
|
||||||
|
parallel = true
|
||||||
|
concurrency = [
|
||||||
|
'thread'
|
||||||
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Homepage = "https://chacha.ddns.net/gitea/chacha/pygitversionhelper/"
|
Homepage = "https://chacha.ddns.net/gitea/chacha/pygitversionhelper/"
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
# pygitversionhelper (c) by chacha
|
|
||||||
#
|
|
||||||
# pygitversionhelper is licensed under a
|
|
||||||
# Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Unported License.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the license along with this
|
|
||||||
# work. If not, see <https://creativecommons.org/licenses/by-nc-sa/4.0/>.
|
|
||||||
@@ -65,10 +65,12 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
def _exec(cmd: str, root: Optional[str | os.PathLike[str]] = None, raw: bool = False) -> str | List[str]:
|
def _exec(cmd: str, root: Optional[str | os.PathLike[str]] = None, raw: bool = False) -> str | List[str]:
|
||||||
"""helper function to handle system cmd execution
|
"""helper function to handle system cmd execution
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
cmd: command line to be executed
|
cmd: command line to be executed
|
||||||
root: root directory where the command need to be executed
|
root: root directory where the command need to be executed
|
||||||
raw: return bytes if True, str if False or None
|
raw: return bytes if True, str if False or None
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
a list of command's return lines or the raw output
|
a list of command's return lines or the raw output
|
||||||
|
|
||||||
@@ -134,8 +136,10 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def isDirty(cls) -> bool:
|
def isDirty(cls) -> bool:
|
||||||
"""check if the repository is in dirty state
|
"""check if the repository is in dirty state
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True if it is dirty
|
True if it is dirty
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return bool(_exec("git status --short"))
|
return bool(_exec("git status --short"))
|
||||||
|
|
||||||
@@ -151,16 +155,19 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def getMessagesSinceTag(cls, tag: str, **kwargs: Unpack[TKwargs]) -> str | List[str]:
|
def getMessagesSinceTag(cls, tag: str, **kwargs: Unpack[TKwargs]) -> str | List[str]:
|
||||||
"""Retrieve a commits message history from repository.
|
"""Retrieve a commits message history from repository.
|
||||||
|
|
||||||
Start from Latest found commit until the given tag.
|
Start from Latest found commit until the given tag.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
tag: tag of the commit where search will stop
|
tag (str): tag of the commit where search will stop
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/merged_output (bool): Output one single merged string
|
kwargs/merged_output (bool): Output one single merged string
|
||||||
kwargs/same_branch (bool): Force searching only in the same branch
|
kwargs/same_branch (bool): Force searching only in the same branch
|
||||||
kwargs/ignore_merged (bool): ignore merged commits
|
kwargs/ignore_merged (bool): ignore merged commits
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
the commit message
|
the commit message
|
||||||
|
|
||||||
"""
|
"""
|
||||||
current_commit_id = cls.getLast(**kwargs)
|
current_commit_id = cls.getLast(**kwargs)
|
||||||
tag_commit_id = cls.getFromTag(tag)
|
tag_commit_id = cls.getFromTag(tag)
|
||||||
@@ -190,10 +197,13 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def getMessage(cls, commit_hash: str) -> str:
|
def getMessage(cls, commit_hash: str) -> str:
|
||||||
"""retrieve a commit message from repository
|
"""retrieve a commit message from repository
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
commit_hash: id of the commit
|
commit_hash: id of the commit
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
the commit message
|
the commit message
|
||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
res = _exec(
|
res = _exec(
|
||||||
@@ -210,10 +220,13 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def getFromTag(cls, tag: str) -> str:
|
def getFromTag(cls, tag: str) -> str:
|
||||||
"""retrieve a commit from repository associated to a tag
|
"""retrieve a commit from repository associated to a tag
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
tag: tag of the commit
|
tag: tag of the commit
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
the commit Id
|
the commit Id
|
||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
res = _exec(f"git rev-list -n 1 {tag}") # ok
|
res = _exec(f"git rev-list -n 1 {tag}") # ok
|
||||||
@@ -227,11 +240,14 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def getLast(cls, **kwargs: Unpack[TKwargs]) -> str:
|
def getLast(cls, **kwargs: Unpack[TKwargs]) -> str:
|
||||||
"""retrieve last commit from repository
|
"""retrieve last commit from repository
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/same_branch (bool): force searching only in the same branch
|
kwargs/same_branch (bool): force searching only in the same branch
|
||||||
kwargs/ignore_merged (bool): ignore merged commits
|
kwargs/ignore_merged (bool): ignore merged commits
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
the commit Id
|
the commit Id
|
||||||
|
|
||||||
"""
|
"""
|
||||||
str_cmd: str
|
str_cmd: str
|
||||||
if ("same_branch" in kwargs) and (kwargs["same_branch"] is True):
|
if ("same_branch" in kwargs) and (kwargs["same_branch"] is True):
|
||||||
@@ -276,12 +292,16 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def getTags(cls, Sort: str = "taggerdate", **kwargs: Unpack[TKwargs]) -> List[str]:
|
def getTags(cls, Sort: str = "taggerdate", **kwargs: Unpack[TKwargs]) -> List[str]:
|
||||||
"""retrieve all tags from a repository
|
"""retrieve all tags from a repository
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
Sort: sorting constraints (git format)
|
Sort: sorting constraints (git format)
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/same_branch (bool): force searching only in the same branch
|
kwargs/same_branch (bool): force searching only in the same branch
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
the tags list
|
the tags list
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if Sort not in cls.__validGitTagSort:
|
if Sort not in cls.__validGitTagSort:
|
||||||
@@ -295,10 +315,13 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def getLastTag(cls, **kwargs: Unpack[TKwargs]) -> str:
|
def getLastTag(cls, **kwargs: Unpack[TKwargs]) -> str:
|
||||||
"""retrieve the Latest tag from a repository
|
"""retrieve the Latest tag from a repository
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/same_branch (bool): force searching only in the same branch
|
kwargs/same_branch (bool): force searching only in the same branch
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
the tag
|
the tag
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if ("same_branch" in kwargs) and (kwargs["same_branch"] is True):
|
if ("same_branch" in kwargs) and (kwargs["same_branch"] is True):
|
||||||
res = _exec("git describe --tags --first-parent --abbrev=0")
|
res = _exec("git describe --tags --first-parent --abbrev=0")
|
||||||
@@ -316,12 +339,16 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def getDistanceFromTag(cls, tag: Optional[str] = None, **kwargs: Unpack[TKwargs]) -> int:
|
def getDistanceFromTag(cls, tag: Optional[str] = None, **kwargs: Unpack[TKwargs]) -> int:
|
||||||
"""retrieve the distance between Latest commit and tag in the repository
|
"""retrieve the distance between Latest commit and tag in the repository
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
tag: reference tag, if None the most recent one will be used
|
tag: reference tag, if None the most recent one will be used
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/same_branch (bool): force searching only in the same branch
|
kwargs/same_branch (bool): force searching only in the same branch
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
the tag
|
the tag
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if tag is None:
|
if tag is None:
|
||||||
tag = cls.getLastTag(**kwargs)
|
tag = cls.getLastTag(**kwargs)
|
||||||
@@ -397,10 +424,13 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def _getBumpDevStrategy(cls, **kwargs: Unpack[TKwargs]) -> str:
|
def _getBumpDevStrategy(cls, **kwargs: Unpack[TKwargs]) -> str:
|
||||||
"""get selected bump_dev_strategy
|
"""get selected bump_dev_strategy
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/bump_dev_strategy (str): the given bump_dev_strategy (can be None)
|
kwargs/bump_dev_strategy (str): the given bump_dev_strategy (can be None)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Kwargs given bump_dev_strategy or the default one.
|
Kwargs given bump_dev_strategy or the default one.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
BumpDevStrategy: str = cls.DefaultBumpDevStrategy
|
BumpDevStrategy: str = cls.DefaultBumpDevStrategy
|
||||||
|
|
||||||
@@ -414,10 +444,13 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def _getBumpType(cls, **kwargs: Unpack[TKwargs]) -> str:
|
def _getBumpType(cls, **kwargs: Unpack[TKwargs]) -> str:
|
||||||
"""get selected bump_type
|
"""get selected bump_type
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/bump_type (str): the given bump_type (can be None)
|
kwargs/bump_type (str): the given bump_type (can be None)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Kwargs given bump_type or the default one.
|
Kwargs given bump_type or the default one.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
BumpType: str = cls.DefaultBumpType
|
BumpType: str = cls.DefaultBumpType
|
||||||
if "bump_type" in kwargs:
|
if "bump_type" in kwargs:
|
||||||
@@ -431,13 +464,17 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
self, amount: int = 1, **kwargs: Unpack[TKwargs]
|
self, amount: int = 1, **kwargs: Unpack[TKwargs]
|
||||||
) -> gitversionhelper.version.MetaVersion | str:
|
) -> gitversionhelper.version.MetaVersion | str:
|
||||||
"""bump the version to the next one
|
"""bump the version to the next one
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
amount: number of revision to bump
|
amount: number of revision to bump
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/bump_type (str): the given bump_type (can be None)
|
kwargs/bump_type (str): the given bump_type (can be None)
|
||||||
kwargs/bump_dev_strategy (str): the given bump_dev_strategy (can be None)
|
kwargs/bump_dev_strategy (str): the given bump_dev_strategy (can be None)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
the bumped version
|
the bumped version
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
BumpType: str = self._getBumpType(**kwargs)
|
BumpType: str = self._getBumpType(**kwargs)
|
||||||
@@ -488,20 +525,26 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
|
|
||||||
def doFormatVersion(self, **kwargs: Unpack[TKwargs]) -> str:
|
def doFormatVersion(self, **kwargs: Unpack[TKwargs]) -> str:
|
||||||
"""output a formated version string
|
"""output a formated version string
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/output_format: output format to render ("Auto" or "PEP440" or "SemVer")
|
kwargs/output_format: output format to render ("Auto" or "PEP440" or "SemVer")
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
formated version string
|
formated version string
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return gitversionhelper.version.doFormatVersion(self, **kwargs)
|
return gitversionhelper.version.doFormatVersion(self, **kwargs)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _getVersionStd(cls, **kwargs: Unpack[TKwargs]) -> gitversionhelper.version.MetaVersion.TVersionStd:
|
def _getVersionStd(cls, **kwargs: Unpack[TKwargs]) -> gitversionhelper.version.MetaVersion.TVersionStd:
|
||||||
"""get selected version_std
|
"""get selected version_std
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/version_std (str): the given version_std (can be None)
|
kwargs/version_std (str): the given version_std (can be None)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Kwargs given version_std or the default one.
|
Kwargs given version_std or the default one.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
VersionStd: str = cls.DefaultInputFormat
|
VersionStd: str = cls.DefaultInputFormat
|
||||||
if "version_std" in kwargs:
|
if "version_std" in kwargs:
|
||||||
@@ -514,6 +557,7 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def getCurrentVersion(cls, **kwargs: Unpack[TKwargs]) -> gitversionhelper.version.MetaVersion | str:
|
def getCurrentVersion(cls, **kwargs: Unpack[TKwargs]) -> gitversionhelper.version.MetaVersion | str:
|
||||||
"""get the current version or bump depending of repository state.
|
"""get the current version or bump depending of repository state.
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/version_std (str): the given version_std (can be None)
|
kwargs/version_std (str): the given version_std (can be None)
|
||||||
kwargs/same_branch (bool): force searching only in the same branch
|
kwargs/same_branch (bool): force searching only in the same branch
|
||||||
@@ -521,8 +565,10 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
kwargs/bump_type (str): the given bump_type (can be None)
|
kwargs/bump_type (str): the given bump_type (can be None)
|
||||||
kwargs/bump_dev_strategy (str): the given bump_dev_strategy (can be None)
|
kwargs/bump_dev_strategy (str): the given bump_dev_strategy (can be None)
|
||||||
kwargs/output_format (str): output format to render ("Auto" or "PEP440" or "SemVer")
|
kwargs/output_format (str): output format to render ("Auto" or "PEP440" or "SemVer")
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
the last version
|
the last version
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if gitversionhelper.repository.isDirty() is not False:
|
if gitversionhelper.repository.isDirty() is not False:
|
||||||
raise gitversionhelper.repository.repositoryDirty("The repository is dirty and a current version can not be generated.")
|
raise gitversionhelper.repository.repositoryDirty("The repository is dirty and a current version can not be generated.")
|
||||||
@@ -544,14 +590,17 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def getCurrentFormatedVersion(cls, **kwargs: Unpack[TKwargs]) -> str:
|
def getCurrentFormatedVersion(cls, **kwargs: Unpack[TKwargs]) -> str:
|
||||||
"""same as getCurrentVersion() with formated_output kwarg forced activated.
|
"""same as getCurrentVersion() with formated_output kwarg forced activated.
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/version_std (str): the given version_std (can be None)
|
kwargs/version_std (str): the given version_std (can be None)
|
||||||
kwargs/same_branch (bool): force searching only in the same branch
|
kwargs/same_branch (bool): force searching only in the same branch
|
||||||
kwargs/bump_type (str): the given bump_type (can be None)
|
kwargs/bump_type (str): the given bump_type (can be None)
|
||||||
kwargs/bump_dev_strategy (str): the given bump_dev_strategy (can be None)
|
kwargs/bump_dev_strategy (str): the given bump_dev_strategy (can be None)
|
||||||
kwargs/output_format (str): output format to render ("Auto" or "PEP440" or "SemVer")
|
kwargs/output_format (str): output format to render ("Auto" or "PEP440" or "SemVer")
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
the last version
|
the last version
|
||||||
|
|
||||||
"""
|
"""
|
||||||
kwargs["formated_output"] = True
|
kwargs["formated_output"] = True
|
||||||
return cast(str, cls.getCurrentVersion(**kwargs))
|
return cast(str, cls.getCurrentVersion(**kwargs))
|
||||||
@@ -561,12 +610,16 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
cls, tag: str, **kwargs: Unpack[TKwargs]
|
cls, tag: str, **kwargs: Unpack[TKwargs]
|
||||||
) -> gitversionhelper.version.MetaVersion:
|
) -> gitversionhelper.version.MetaVersion:
|
||||||
"""get version from tags.
|
"""get version from tags.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
tag: the tag to be parsed
|
tag: the tag to be parsed
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/version_std (str): the given version_std (can be None)
|
kwargs/version_std (str): the given version_std (can be None)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
MetaVersion object
|
MetaVersion object
|
||||||
|
|
||||||
"""
|
"""
|
||||||
_m: Optional[re.Match[str]]
|
_m: Optional[re.Match[str]]
|
||||||
VersionStd: gitversionhelper.version.MetaVersion.TVersionStd = cls._getVersionStd(**kwargs)
|
VersionStd: gitversionhelper.version.MetaVersion.TVersionStd = cls._getVersionStd(**kwargs)
|
||||||
@@ -639,13 +692,16 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def getLastVersion(cls, **kwargs: Unpack[TKwargs]) -> gitversionhelper.version.MetaVersion | str: # pylint: disable=R1260
|
def getLastVersion(cls, **kwargs: Unpack[TKwargs]) -> gitversionhelper.version.MetaVersion | str: # pylint: disable=R1260
|
||||||
"""get the last version from tags
|
"""get the last version from tags
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/version_std (str): the given version_std (can be None)
|
kwargs/version_std (str): the given version_std (can be None)
|
||||||
kwargs/same_branch (bool): force searching only in the same branch
|
kwargs/same_branch (bool): force searching only in the same branch
|
||||||
kwargs/formated_output (bool): output a formated version string
|
kwargs/formated_output (bool): output a formated version string
|
||||||
kwargs/ignore_unknown_tags (bool): skip tags with not decoded versions (default to False)
|
kwargs/ignore_unknown_tags (bool): skip tags with not decoded versions (default to False)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
the last version in MetaVersion object or string
|
the last version in MetaVersion object or string
|
||||||
|
|
||||||
"""
|
"""
|
||||||
lastTag: str = cls.MetaVersion.raw
|
lastTag: str = cls.MetaVersion.raw
|
||||||
cls.__versionReseted = False
|
cls.__versionReseted = False
|
||||||
@@ -678,12 +734,16 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
|
|||||||
@classmethod
|
@classmethod
|
||||||
def doFormatVersion(cls, inputversion: MetaVersion, **kwargs: Unpack[TKwargs]) -> str:
|
def doFormatVersion(cls, inputversion: MetaVersion, **kwargs: Unpack[TKwargs]) -> str:
|
||||||
"""output a formated version string from a MetaVersion object
|
"""output a formated version string from a MetaVersion object
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
kwargs/output_format (str): output format to render ("Auto" or "PEP440" or "SemVer")
|
kwargs/output_format (str): output format to render ("Auto" or "PEP440" or "SemVer")
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
inputversion: version to be rendered
|
inputversion: version to be rendered
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
formated version string
|
formated version string
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
VersionStd = cls._getVersionStd(**kwargs)
|
VersionStd = cls._getVersionStd(**kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user