storage*: Hex encode content hashes in HashCollision exception
This encodes the collision's referenced colliding hashes into hex hashes. This does the encoding at HashCollision instanciation time.
This provides a content_colliding_hashes
method to retrieve the hashes as a dict of bytes.
This is mainly for client which captures the exception and wants to do something with it.
For example the replayer does capture the colliding hashes, log them and put them aside to reapply the transaction without those.
Note that it also moves the HashCollision exception to the swh.storage.exc
module.
Related to T2332#42793
Impact:
- swh.journal: retry behavior which puts aside colliding hashes D2874
Test Plan
tox
Migrated from D2872 (view on Phabricator)