Migrate away from revision_get_by / revision_log_by
The revision_get_by
endpoint of the storage API is a pretty intricate piece of code, which joins across five tables (origin_visit -> snapshot -> snapshot_branches -> snapshot_branch -> revision) and doesn't handle edge cases very well (for instance, it won't return anything if that branch points to anything other than a revision).
The only view that uses this function is https://archive.softwareheritage.org/api/1/revision/origin/
It'd be less error-prone to do the lookup on the client side in two or three steps:
- look up the visit by timestamp, get a snapshot id; return an error if there was no such visit
- look up the branch pointer from the snapshot id, return a typed target
- look up the typed object and return that to the caller (or have the caller do the indirection themselves)
This is potentially related to #1207 (closed) as the second item in that list could use the same storage endpoint.
Migrated from T1221 (view on Phabricator)