mirror of
https://github.com/lilydjwg/nvchecker
synced 2025-01-10 00:09:27 +00:00
commit
121b94a7eb
@ -641,6 +641,19 @@ strip_release
|
||||
|
||||
Note that either pkg or srcpkg needs to be specified (but not both) or the item name will be used as pkg.
|
||||
|
||||
Check Git repository
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
::
|
||||
|
||||
source = "git"
|
||||
|
||||
This enables you to check tags of an arbitrary git repository, also useful for scenarios like a github project having too many tags.
|
||||
|
||||
url
|
||||
URL of the Git repository.
|
||||
|
||||
This source returns tags and supports :ref:`list options`.
|
||||
|
||||
Manually updating
|
||||
~~~~~~~~~~~~~~~~~
|
||||
::
|
||||
|
13
nvchecker_source/git.py
Normal file
13
nvchecker_source/git.py
Normal file
@ -0,0 +1,13 @@
|
||||
# MIT licensed
|
||||
# Copyright (c) 2020 Felix Yan <felixonmars@archlinux.org>, et al.
|
||||
|
||||
from .cmd import run_cmd # type: ignore
|
||||
|
||||
async def get_version(
|
||||
name, conf, *, cache, keymanager=None
|
||||
):
|
||||
git = conf['git']
|
||||
cmd = f"git ls-remote -t --refs {git}"
|
||||
data = await cache.get(cmd, run_cmd)
|
||||
versions = [line.split("refs/tags/")[1] for line in data.splitlines()]
|
||||
return versions
|
11
tests/test_git.py
Normal file
11
tests/test_git.py
Normal file
@ -0,0 +1,11 @@
|
||||
# MIT licensed
|
||||
# Copyright (c) 2020 Felix Yan <felixonmars@archlinux.org>, et al.
|
||||
|
||||
import pytest
|
||||
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
|
||||
|
||||
async def test_git(get_version):
|
||||
assert await get_version("example", {
|
||||
"source": "git",
|
||||
"git": "https://gitlab.com/gitlab-org/gitlab-test.git",
|
||||
}) == "v1.1.1"
|
Loading…
Reference in New Issue
Block a user