Page MenuHomeSoftware Heritage

D2874.diff
No OneTemporary

D2874.diff

diff --git a/requirements-swh.txt b/requirements-swh.txt
--- a/requirements-swh.txt
+++ b/requirements-swh.txt
@@ -1,3 +1,3 @@
swh.core[db,http] >= 0.0.60
swh.model >= 0.0.60
-swh.storage >= 0.0.178
+swh.storage >= 0.0.181
diff --git a/swh/journal/replay.py b/swh/journal/replay.py
--- a/swh/journal/replay.py
+++ b/swh/journal/replay.py
@@ -31,7 +31,7 @@
from swh.objstorage.objstorage import (
ID_HASH_ALGO, ObjNotFoundError, ObjStorage,
)
-from swh.storage import HashCollision
+from swh.storage.exc import HashCollision
logger = logging.getLogger(__name__)
@@ -85,14 +85,12 @@
try:
content_add_fn(contents)
except HashCollision as e:
- algo, hash_id, colliding_hashes = e.args
- hash_id = hash_to_hex(hash_id)
colliding_content_hashes.append({
- 'algo': algo,
- 'hash': hash_to_hex(hash_id),
- 'objects': [{k: hash_to_hex(v) for k, v in collision.items()}
- for collision in colliding_hashes]
+ 'algo': e.algo,
+ 'hash': e.hash_id, # hex hash id
+ 'objects': e.colliding_contents # hex hashes
})
+ colliding_hashes = e.colliding_content_hashes()
# Drop the colliding contents from the transaction
contents = [c for c in contents
if c.hashes() not in colliding_hashes]
diff --git a/swh/journal/tests/test_write_replay.py b/swh/journal/tests/test_write_replay.py
--- a/swh/journal/tests/test_write_replay.py
+++ b/swh/journal/tests/test_write_replay.py
@@ -14,7 +14,8 @@
object_dicts, present_contents
)
from swh.model.model import Origin
-from swh.storage import get_storage, HashCollision
+from swh.storage import get_storage
+from swh.storage.exc import HashCollision
from swh.journal.replay import (
process_replay_objects, process_replay_objects_content, object_converter_fn

File Metadata

Mime Type
text/plain
Expires
Dec 21 2024, 6:40 PM (11 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219649

Event Timeline