mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
parent
2f4629fb22
commit
7de923c1e1
5 changed files with 6 additions and 9 deletions
|
@ -11,7 +11,6 @@ async def get_version(name, conf, *, cache, **kwargs):
|
||||||
repo = conf.get('bitbucket')
|
repo = conf.get('bitbucket')
|
||||||
br = conf.get('branch', '')
|
br = conf.get('branch', '')
|
||||||
use_max_tag = conf.get('use_max_tag', False)
|
use_max_tag = conf.get('use_max_tag', False)
|
||||||
ignored_tags = conf.get("ignored_tags", "").split()
|
|
||||||
sort_version_key = sort_version_keys[conf.get("sort_version_key", "parse_version")]
|
sort_version_key = sort_version_keys[conf.get("sort_version_key", "parse_version")]
|
||||||
|
|
||||||
if use_max_tag:
|
if use_max_tag:
|
||||||
|
@ -24,7 +23,6 @@ async def get_version(name, conf, *, cache, **kwargs):
|
||||||
data = await cache.get_json(url)
|
data = await cache.get_json(url)
|
||||||
|
|
||||||
if use_max_tag:
|
if use_max_tag:
|
||||||
data = [tag for tag in data if tag not in ignored_tags]
|
|
||||||
data.sort(key=sort_version_key)
|
data.sort(key=sort_version_key)
|
||||||
version = data
|
version = data
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -27,7 +27,6 @@ def _parse_oldver(oldver):
|
||||||
async def get_version(name, conf, *, cache, **kwargs):
|
async def get_version(name, conf, *, cache, **kwargs):
|
||||||
vcs = conf['vcs'] or ''
|
vcs = conf['vcs'] or ''
|
||||||
use_max_tag = conf.get('use_max_tag', False)
|
use_max_tag = conf.get('use_max_tag', False)
|
||||||
ignored_tags = conf.get("ignored_tags", "").split()
|
|
||||||
oldver = conf.get('oldver')
|
oldver = conf.get('oldver')
|
||||||
cmd = _cmd_prefix + [name, vcs]
|
cmd = _cmd_prefix + [name, vcs]
|
||||||
if use_max_tag:
|
if use_max_tag:
|
||||||
|
@ -36,7 +35,7 @@ async def get_version(name, conf, *, cache, **kwargs):
|
||||||
output = await cache.get(tuple(cmd), run_cmd)
|
output = await cache.get(tuple(cmd), run_cmd)
|
||||||
|
|
||||||
if use_max_tag:
|
if use_max_tag:
|
||||||
return [tag for tag in output.split("\n") if tag not in ignored_tags]
|
return [tag for tag in output.split("\n")]
|
||||||
else:
|
else:
|
||||||
oldvers = _parse_oldver(oldver)
|
oldvers = _parse_oldver(oldver)
|
||||||
if output == oldvers[2]:
|
if output == oldvers[2]:
|
||||||
|
|
|
@ -17,10 +17,10 @@ async def test_bitbucket_max_tag(get_version):
|
||||||
"use_max_tag": True,
|
"use_max_tag": True,
|
||||||
}) == "1.7.0"
|
}) == "1.7.0"
|
||||||
|
|
||||||
async def test_bitbucket_max_tag_with_ignored_tags(get_version):
|
async def test_bitbucket_max_tag_with_ignored(get_version):
|
||||||
assert await get_version("example", {
|
assert await get_version("example", {
|
||||||
"source": "bitbucket",
|
"source": "bitbucket",
|
||||||
"bitbucket": "prawee/git-tag",
|
"bitbucket": "prawee/git-tag",
|
||||||
"use_max_tag": True,
|
"use_max_tag": True,
|
||||||
"ignored_tags": "1.6.0 1.7.0",
|
"ignored": "1.6.0 1.7.0",
|
||||||
}) == "v1.5"
|
}) == "v1.5"
|
||||||
|
|
|
@ -19,7 +19,7 @@ async def test_gitea_max_tag(get_version):
|
||||||
"use_max_tag": True,
|
"use_max_tag": True,
|
||||||
}) == "v0.4.0"
|
}) == "v0.4.0"
|
||||||
|
|
||||||
async def test_gitea_max_tag_with_ignored_tags(get_version):
|
async def test_gitea_max_tag_with_ignored(get_version):
|
||||||
assert await get_version("example", {
|
assert await get_version("example", {
|
||||||
"source": "gitea",
|
"source": "gitea",
|
||||||
"gitea": "gitea/tea",
|
"gitea": "gitea/tea",
|
||||||
|
|
|
@ -33,10 +33,10 @@ async def test_git_max_tag(get_version):
|
||||||
|
|
||||||
@pytest.mark.skipif(shutil.which("git") is None,
|
@pytest.mark.skipif(shutil.which("git") is None,
|
||||||
reason="requires git command")
|
reason="requires git command")
|
||||||
async def test_git_max_tag_with_ignored_tags(get_version):
|
async def test_git_max_tag_with_ignored(get_version):
|
||||||
assert await get_version("example", {
|
assert await get_version("example", {
|
||||||
"source": "vcs",
|
"source": "vcs",
|
||||||
"vcs": "git+https://github.com/harry-sanabria/ReleaseTestRepo.git",
|
"vcs": "git+https://github.com/harry-sanabria/ReleaseTestRepo.git",
|
||||||
"use_max_tag": 1,
|
"use_max_tag": 1,
|
||||||
"ignored_tags": "second_release release3",
|
"ignored": "second_release release3",
|
||||||
}) == "first_release"
|
}) == "first_release"
|
||||||
|
|
Loading…
Add table
Reference in a new issue