Skip to content

Commit

Permalink
Check for existing parent commits in import-all
Browse files Browse the repository at this point in the history
closes pulp#279
  • Loading branch information
lubosmj committed Sep 4, 2023
1 parent 9f904d9 commit 1380d04
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES/279.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Made the import-all facility to accept imports with already imported parent commits.
19 changes: 13 additions & 6 deletions pulp_ostree/app/tasks/importing.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,17 @@ async def parse_ref(self, name, ref_commit_checksum, has_referenced_parent=False
# and this state is still considered valid
return parent_checksum, ref_commit_dc
else:
raise ValueError(
gettext("The parent commit '{}' could not be loaded").format(parent_checksum)
)
try:
parent_commit = await OstreeCommit.objects.aget(checksum=parent_checksum)
except OstreeCommit.DoesNotExist:
raise ValueError(
gettext("The parent commit '{}' could not be loaded").format(
parent_checksum
)
)
else:
await self.copy_from_storage_to_tmp(parent_commit, parent_commit.objs)
_, parent_commit, _ = self.repo.load_commit(parent_checksum)

return await self.load_next_commits(parent_commit, parent_checksum, has_referenced_parent)

Expand Down Expand Up @@ -306,9 +314,8 @@ async def run(self):
if self.compute_delta:
num_of_parsed_commits = len(self.commit_dcs)

parent_commit = await OstreeCommit.objects.aget(
checksum=ref_commit_checksum
).parent_commit
commit = await OstreeCommit.objects.aget(checksum=ref_commit_checksum)
parent_commit = commit.parent_commit
if parent_commit and num_of_parsed_commits == 1:
await self.copy_from_storage_to_tmp(parent_commit, parent_commit.objs)
await self.compute_static_delta(
Expand Down

0 comments on commit 1380d04

Please sign in to comment.