Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/git/dumb.py
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | class GitObjectsFetcher: | ||||
def fetch_object_ids(self) -> None: | def fetch_object_ids(self) -> None: | ||||
"""Fetches identifiers of git objects to load into the archive.""" | """Fetches identifiers of git objects to load into the archive.""" | ||||
wants = self.base_repo.determine_wants(self.refs) | wants = self.base_repo.determine_wants(self.refs) | ||||
# process refs | # process refs | ||||
commit_objects = [] | commit_objects = [] | ||||
for ref in wants: | for ref in wants: | ||||
ref_object = self._get_git_object(ref) | ref_object = self._get_git_object(ref) | ||||
if ref_object.get_type() == Commit.type_num: | if ref_object.type_num == Commit.type_num: | ||||
commit_objects.append(cast(Commit, ref_object)) | commit_objects.append(cast(Commit, ref_object)) | ||||
self.objects[b"commit"].add(ref) | self.objects[b"commit"].add(ref) | ||||
else: | else: | ||||
self.objects[b"tag"].add(ref) | self.objects[b"tag"].add(ref) | ||||
# perform DFS on commits graph | # perform DFS on commits graph | ||||
while commit_objects: | while commit_objects: | ||||
commit = commit_objects.pop() | commit = commit_objects.pop() | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |