mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 14:30:09 +01:00
check for tag if tag-num specified
This commit is contained in:
parent
6d727ad1e7
commit
a2a302bce2
3 changed files with 21 additions and 1 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -217,3 +217,6 @@ fabric.properties
|
||||||
|
|
||||||
# Android studio 3.1+ serialized cache file
|
# Android studio 3.1+ serialized cache file
|
||||||
.idea/caches/build_file_checksums.ser
|
.idea/caches/build_file_checksums.ser
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode
|
||||||
|
|
|
||||||
|
|
@ -754,6 +754,11 @@ def incr(
|
||||||
else:
|
else:
|
||||||
cur_vinfo = old_vinfo._replace(**cur_cinfo._asdict())
|
cur_vinfo = old_vinfo._replace(**cur_cinfo._asdict())
|
||||||
|
|
||||||
|
has_tag_part = cur_vinfo.tag != "final"
|
||||||
|
if tag_num and not tag and not has_tag_part:
|
||||||
|
logger.error("Invalid arguments, non-final --tag=<tag> is needed to use --tag-num.")
|
||||||
|
return None
|
||||||
|
|
||||||
cur_vinfo = _incr_numeric(
|
cur_vinfo = _incr_numeric(
|
||||||
raw_pattern,
|
raw_pattern,
|
||||||
old_vinfo,
|
old_vinfo,
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,18 @@ def test_bump_random(monkeypatch):
|
||||||
cur_version = new_version
|
cur_version = new_version
|
||||||
|
|
||||||
|
|
||||||
|
def test_bump_tag_num():
|
||||||
|
raw_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
|
||||||
|
cur_version = "0.1.1b0"
|
||||||
|
assert v2version.incr(cur_version, raw_pattern, tag_num=True ) == "0.1.1b1"
|
||||||
|
|
||||||
|
|
||||||
|
def test_bump_tag_num_without_tag():
|
||||||
|
raw_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
|
||||||
|
cur_version = "0.1.1"
|
||||||
|
assert v2version.incr(cur_version, raw_pattern, tag_num=True ) == None
|
||||||
|
|
||||||
|
|
||||||
def test_parse_version_info():
|
def test_parse_version_info():
|
||||||
version_str = "v201712.0001-alpha"
|
version_str = "v201712.0001-alpha"
|
||||||
version_info = v1version.parse_version_info(version_str)
|
version_info = v1version.parse_version_info(version_str)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue