importer: Address upstream hash ref list issue

There are cases where upstream (stream 10 for example) have repos for
packages that they plan or will ship, but there are no references
associated. Meaning, there's no branches, there's no data, nothing to
work off of.
This commit is contained in:
Louis Abel 2024-03-10 20:54:43 -07:00
parent 7f2004719a
commit ff35a29d08
Signed by: label
GPG Key ID: 2A6975660E424560

View File

@ -139,8 +139,11 @@ def tag(repo, tag_name:str, message: str):
def lsremote(url): def lsremote(url):
""" """
Helps check if a repo exists, and if it does, return references. If not, Helps check if a repo exists.
return None and assume it doesn't exist.
If repo exists: return references
If repo exists and is completely empty: return empty dict
If repo does not exist: return None
""" """
remote_refs = {} remote_refs = {}
git_cmd = rawgit.cmd.Git() git_cmd = rawgit.cmd.Git()
@ -153,5 +156,6 @@ def lsremote(url):
for ref in git_cmd.ls_remote(url).split('\n'): for ref in git_cmd.ls_remote(url).split('\n'):
hash_ref_list = ref.split('\t') hash_ref_list = ref.split('\t')
remote_refs[hash_ref_list[1]] = hash_ref_list[0] if len(hash_ref_list) > 1:
remote_refs[hash_ref_list[1]] = hash_ref_list[0]
return remote_refs return remote_refs