Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/mercurial/from_disk.py
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | def prepare(self) -> None: | ||||
the loader. | the loader. | ||||
""" | """ | ||||
# Set here to allow multiple calls to load on the same loader instance | # Set here to allow multiple calls to load on the same loader instance | ||||
self._latest_heads = [] | self._latest_heads = [] | ||||
latest_snapshot = snapshot_get_latest(self.storage, self.origin_url) | latest_snapshot = snapshot_get_latest(self.storage, self.origin_url) | ||||
if latest_snapshot: | if latest_snapshot: | ||||
# TODO: add support for releases | |||||
snapshot_branches = [ | snapshot_branches = [ | ||||
branch.target | branch.target | ||||
for branch in latest_snapshot.branches.values() | for branch in latest_snapshot.branches.values() | ||||
if branch.target_type != TargetType.ALIAS | if branch.target_type == TargetType.REVISION | ||||
] | ] | ||||
self._latest_heads = [ | self._latest_heads = [ | ||||
hash_to_bytes(revision.metadata["node"]) | hash_to_bytes(revision.metadata["node"]) | ||||
for revision in self.storage.revision_get(snapshot_branches) | for revision in self.storage.revision_get(snapshot_branches) | ||||
if revision and revision.metadata | if revision and revision.metadata | ||||
] | ] | ||||
def fetch_data(self) -> bool: | def fetch_data(self) -> bool: | ||||
"""Fetch the data from the source the loader is currently loading | """Fetch the data from the source the loader is currently loading | ||||
▲ Show 20 Lines • Show All 403 Lines • Show Last 20 Lines |