Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7342956
D3305.id11816.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D3305.id11816.diff
View Options
diff --git a/swh/loader/package/loader.py b/swh/loader/package/loader.py
--- a/swh/loader/package/loader.py
+++ b/swh/loader/package/loader.py
@@ -32,7 +32,7 @@
)
from swh.storage import get_storage
from swh.storage.utils import now
-from swh.storage.algos.snapshot import snapshot_get_all_branches
+from swh.storage.algos.snapshot import snapshot_get_latest
from swh.loader.package.utils import download
@@ -120,17 +120,10 @@
return ""
def last_snapshot(self) -> Optional[Snapshot]:
- """Retrieve the last snapshot
+ """Retrieve the last snapshot out of the last visit.
"""
- snapshot = None
- visit = self.storage.origin_visit_get_latest(self.url, require_snapshot=True)
- snapshot_id = None if not visit else visit.get("snapshot")
- if snapshot_id is not None:
- snapshot_dict = snapshot_get_all_branches(self.storage, snapshot_id)
- if snapshot_dict:
- snapshot = Snapshot.from_dict(snapshot_dict)
- return snapshot
+ return snapshot_get_latest(self.storage, self.url)
def known_artifacts(self, snapshot: Optional[Snapshot]) -> Dict[Sha1Git, BaseModel]:
"""Retrieve the known releases/artifact for the origin.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mar 17 2025, 6:20 PM (7 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3228679
Attached To
D3305: package.loader: Retrieve latest snapshot out of the latest visit status
Event Timeline
Log In to Comment