1
0
Fork 0

Simplify ls-remote call

This should also be faster to execute on many pacakges
This commit is contained in:
Luca Beltrame 2022-01-15 09:33:00 +01:00
parent 5a08c4ea0c
commit 38cb46eb99
Signed by: einar
GPG key ID: 4707F46E9EC72DEC

View file

@ -75,20 +75,12 @@ def project_exists(project: str) -> bool:
return False
def lsremote(url: str) -> Dict[str, str]:
remote_refs = {}
gitcmd = git.cmd.Git()
for ref in gitcmd.ls_remote(url).split('\n'):
hash_ref_list = ref.split('\t')
remote_refs[hash_ref_list[1]] = hash_ref_list[0]
return remote_refs
def get_remote_hash(url: str, branch: str = "master") -> str:
refs = "refs/heads/{}".format(branch)
return lsremote(url)[refs]
gitcmd = git.cmd.Git()
revision = gitcmd.ls_remote(url, branch, quiet=True, refs=True)
git_hash, branch = revision.split("\t")
return git_hash
def trigger_update(repository: str, package_name: str,