Storage.content_find should return all matches, not just one.
(from https://forge.softwareheritage.org/!116?id=1994#inline-3203 )
The content_find
method of the storage API takes as argument a dictionary whose keys are names of hash algorithms and values are digests for these hashes.
It then looks at all content blobs in the archive, and looks for blobs whose hashes match all the ones provided.
Most of the time, there are only 0 or 1, and it returns it (if any). But there may be more than 1 in case of hash collisions, and we need to handle that (this is partly why we support more than one hash algorithm).
Therefore, this function should be modified to return a list of contents instead of a single one. It is implemented both in swh/storage/storage.py
(postgresql backend of the storage) and swh/storage/in_memory.py
(in-memory backend, used for tests).
Its tests and other functions using this one should be updated as well.
Migrated from T1349 (view on Phabricator)