Simplify ls-remote call
This should also be faster to execute on many pacakges
This commit is contained in:
parent
5a08c4ea0c
commit
38cb46eb99
1 changed files with 5 additions and 13 deletions
|
@ -75,20 +75,12 @@ def project_exists(project: str) -> bool:
|
||||||
return False
|
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:
|
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,
|
def trigger_update(repository: str, package_name: str,
|
||||||
|
|
Loading…
Add table
Reference in a new issue