remove ignored_tags from vcs and bitbucket sources

See #99.
This commit is contained in:
lilydjwg 2020-08-18 16:35:26 +08:00
parent 2f4629fb22
commit 7de923c1e1
5 changed files with 6 additions and 9 deletions

View file

@ -11,7 +11,6 @@ async def get_version(name, conf, *, cache, **kwargs):
repo = conf.get('bitbucket')
br = conf.get('branch', '')
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")]
if use_max_tag:
@ -24,7 +23,6 @@ async def get_version(name, conf, *, cache, **kwargs):
data = await cache.get_json(url)
if use_max_tag:
data = [tag for tag in data if tag not in ignored_tags]
data.sort(key=sort_version_key)
version = data
else:

View file

@ -27,7 +27,6 @@ def _parse_oldver(oldver):
async def get_version(name, conf, *, cache, **kwargs):
vcs = conf['vcs'] or ''
use_max_tag = conf.get('use_max_tag', False)
ignored_tags = conf.get("ignored_tags", "").split()
oldver = conf.get('oldver')
cmd = _cmd_prefix + [name, vcs]
if use_max_tag:
@ -36,7 +35,7 @@ async def get_version(name, conf, *, cache, **kwargs):
output = await cache.get(tuple(cmd), run_cmd)
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:
oldvers = _parse_oldver(oldver)
if output == oldvers[2]:

View file

@ -17,10 +17,10 @@ async def test_bitbucket_max_tag(get_version):
"use_max_tag": True,
}) == "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", {
"source": "bitbucket",
"bitbucket": "prawee/git-tag",
"use_max_tag": True,
"ignored_tags": "1.6.0 1.7.0",
"ignored": "1.6.0 1.7.0",
}) == "v1.5"

View file

@ -19,7 +19,7 @@ async def test_gitea_max_tag(get_version):
"use_max_tag": True,
}) == "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", {
"source": "gitea",
"gitea": "gitea/tea",

View file

@ -33,10 +33,10 @@ async def test_git_max_tag(get_version):
@pytest.mark.skipif(shutil.which("git") is None,
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", {
"source": "vcs",
"vcs": "git+https://github.com/harry-sanabria/ReleaseTestRepo.git",
"use_max_tag": 1,
"ignored_tags": "second_release release3",
"ignored": "second_release release3",
}) == "first_release"