Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #281/38f6f5fc backport][2.1] Check for existing parent commits in import-all #283

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 facility to accept tarballs with already imported parent commits.
19 changes: 14 additions & 5 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,10 @@ async def run(self):
if self.compute_delta:
num_of_parsed_commits = len(self.commit_dcs)

parent_commit = await OstreeCommit.objects.aget(
commit = await OstreeCommit.objects.select_related("parent_commit").aget(
checksum=ref_commit_checksum
).parent_commit
)
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
Loading