Changeset View
Changeset View
Standalone View
Standalone View
swh/vault/cookers/git_bare.py
| Show All 21 Lines | |||||
| import re | import re | ||||
| import subprocess | import subprocess | ||||
| import tarfile | import tarfile | ||||
| import tempfile | import tempfile | ||||
| from typing import Any, Dict, Iterable, List, Set | from typing import Any, Dict, Iterable, List, Set | ||||
| import zlib | import zlib | ||||
| from swh.core.api.classes import stream_results | from swh.core.api.classes import stream_results | ||||
| from swh.graph.client import GraphArgumentException | |||||
| from swh.model import identifiers | from swh.model import identifiers | ||||
| from swh.model.hashutil import hash_to_bytehex, hash_to_hex | from swh.model.hashutil import hash_to_bytehex, hash_to_hex | ||||
| from swh.model.model import ( | from swh.model.model import ( | ||||
| Person, | Person, | ||||
| Revision, | Revision, | ||||
| RevisionType, | RevisionType, | ||||
| Sha1Git, | Sha1Git, | ||||
| TimestampWithTimezone, | TimestampWithTimezone, | ||||
| ▲ Show 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | def load_objects(self) -> None: | ||||
| content_ids = self._pop(self._cnt_stack, CONTENT_BATCH_SIZE) | content_ids = self._pop(self._cnt_stack, CONTENT_BATCH_SIZE) | ||||
| self.load_contents(content_ids) | self.load_contents(content_ids) | ||||
| def push_revision_subgraph(self, obj_id: Sha1Git) -> None: | def push_revision_subgraph(self, obj_id: Sha1Git) -> None: | ||||
| """Fetches a revision and all its children, and writes them to disk""" | """Fetches a revision and all its children, and writes them to disk""" | ||||
| loaded_from_graph = False | loaded_from_graph = False | ||||
| if self.graph: | if self.graph: | ||||
| from swh.graph.client import GraphArgumentException | |||||
| # First, try to cook using swh-graph, as it is more efficient than | # First, try to cook using swh-graph, as it is more efficient than | ||||
| # swh-storage for querying the history | # swh-storage for querying the history | ||||
| obj_swhid = identifiers.CoreSWHID( | obj_swhid = identifiers.CoreSWHID( | ||||
| object_type=identifiers.ObjectType.REVISION, object_id=obj_id, | object_type=identifiers.ObjectType.REVISION, object_id=obj_id, | ||||
| ) | ) | ||||
| try: | try: | ||||
| revision_ids = ( | revision_ids = ( | ||||
| swhid.object_id | swhid.object_id | ||||
| ▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines | |||||