Skip to content
Snippets Groups Projects
Commit c7739890 authored by vlorentz's avatar vlorentz
Browse files

Call storage.content_get_data() with hash dicts instead of only sha1

parent 27d466e5
No related branches found
No related tags found
1 merge request!181Fix a whole bunch of warnings
Pipeline #1238 passed
......@@ -39,7 +39,18 @@ import re
import subprocess
import tarfile
import tempfile
from typing import Any, Dict, Iterable, Iterator, List, NoReturn, Optional, Set, Tuple
from typing import (
Any,
Dict,
Iterable,
Iterator,
List,
NoReturn,
Optional,
Set,
Tuple,
cast,
)
import zlib
import sentry_sdk
......@@ -63,6 +74,7 @@ from swh.model.model import ObjectType as ModelObjectType
from swh.model.swhids import CoreSWHID, ObjectType
from swh.storage.algos.revisions_walker import DFSRevisionsWalker
from swh.storage.algos.snapshot import snapshot_get_all_branches
from swh.storage.interface import HashDict
from swh.vault.cookers.base import BaseVaultCooker
from swh.vault.to_disk import HIDDEN_MESSAGE, SKIPPED_MESSAGE
......@@ -690,7 +702,10 @@ class GitBareCooker(BaseVaultCooker):
contents_and_data: Iterator[Tuple[Content, Optional[bytes]]]
if self.objstorage is None:
contents_and_data = (
(content, self.storage.content_get_data(content.sha1))
(
content,
self.storage.content_get_data(cast(HashDict, content.hashes())),
)
for content in visible_contents
)
else:
......
......@@ -11,7 +11,7 @@ from typing import Any, Dict, Iterator, List
from swh.model import hashutil
from swh.model.from_disk import DentryPerms, mode_to_perms
from swh.storage.algos.dir_iterators import dir_iterator
from swh.storage.interface import StorageInterface
from swh.storage.interface import HashDict, StorageInterface
MISSING_MESSAGE = (
b"This content is missing from the Software Heritage archive "
......@@ -48,8 +48,11 @@ def get_filtered_files_content(
for file_data in files_data:
status = file_data["status"]
if status == "visible":
sha1 = file_data["sha1"]
data = storage.content_get_data(sha1)
hashes: HashDict = {
"sha1": file_data["sha1"],
"sha1_git": file_data["sha1_git"],
}
data = storage.content_get_data(hashes)
if data is None:
content = SKIPPED_MESSAGE
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment