Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/algos/snapshot.py
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | ) -> Optional[Snapshot]: | ||||
Raises: | Raises: | ||||
ValueError if branches_count is not a positive value | ValueError if branches_count is not a positive value | ||||
Returns: | Returns: | ||||
The snapshot object if one is found matching the criteria or None. | The snapshot object if one is found matching the criteria or None. | ||||
""" | """ | ||||
visit_and_status = origin_get_latest_visit_status( | visit_and_status = origin_get_latest_visit_status( | ||||
storage, origin, allowed_statuses=allowed_statuses, require_snapshot=True | storage, origin, allowed_statuses=allowed_statuses, require_snapshot=True, | ||||
) | ) | ||||
if not visit_and_status: | if not visit_and_status: | ||||
return None | return None | ||||
_, visit_status = visit_and_status | _, visit_status = visit_and_status | ||||
snapshot_id = visit_status.snapshot | snapshot_id = visit_status.snapshot | ||||
if not snapshot_id: | if not snapshot_id: | ||||
Show All 17 Lines |