Get all the branches for a given snapshot
storage (swh.storage.storage.Storage) – the storage instance
snapshot_id (bytes) – the snapshot’s identifier
- a dict with two keys:
id: identifier of the snapshot
branches: a dict of branches contained in the snapshot whose keys are the branches’ names.
- Return type
snapshot_get_latest(storage, origin: str, allowed_statuses: Optional[Iterable[str]] = None, branches_count: Optional[int] = None) → Optional[swh.model.model.Snapshot]¶
Get the latest snapshot for the given origin, optionally only from visits that have one of the given allowed_statuses.
The branches of the snapshot are iterated in the lexicographical order of their names.
storage – Storage instance
origin – the origin’s URL
allowed_statuses – list of visit statuses considered to find the latest snapshot for the visit. For instance,
allowed_statuses=['full']will only consider visits that have successfully run to completion.
branches_count – Optional parameter to retrieve snapshot with all branches (default behavior when None) or not. If set to positive number, the snapshot will be partial with only that number of branches.
ValueError if branches_count is not a positive value –
The snapshot object if one is found matching the criteria or None.