Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9749683
D6012.id21720.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D6012.id21720.diff
View Options
diff --git a/swh/search/journal_client.py b/swh/search/journal_client.py
--- a/swh/search/journal_client.py
+++ b/swh/search/journal_client.py
@@ -4,7 +4,7 @@
# See top-level LICENSE file for more information
import logging
-from typing import Dict
+from typing import Dict, Optional
from swh.model.model import TargetType
from swh.storage.algos.snapshot import snapshot_get_all_branches
@@ -105,12 +105,17 @@
def process_origin_visit_statuses(visit_statuses, search, storage):
logging.debug("processing origin visit statuses %r", visit_statuses)
+ def hexify(b: Optional[bytes]) -> Optional[str]:
+ if b is None:
+ return None
+ return b.hex()
+
full_visit_status = [
{
"url": visit_status["origin"],
"has_visits": True,
"nb_visits": visit_status["visit"],
- "snapshot_id": visit_status.get("snapshot"),
+ "snapshot_id": hexify(visit_status.get("snapshot")),
"last_visit_date": visit_status["date"].isoformat(),
"last_eventful_visit_date": visit_status["date"].isoformat(),
**fetch_last_revision_release_date(visit_status.get("snapshot"), storage),
diff --git a/swh/search/tests/test_journal_client.py b/swh/search/tests/test_journal_client.py
--- a/swh/search/tests/test_journal_client.py
+++ b/swh/search/tests/test_journal_client.py
@@ -239,7 +239,7 @@
"url": "http://foobar.baz",
"has_visits": True,
"nb_visits": 5,
- "snapshot_id": SNAPSHOTS[0].id,
+ "snapshot_id": SNAPSHOTS[0].id.hex(),
"last_visit_date": current_datetime.isoformat(),
"last_eventful_visit_date": current_datetime.isoformat(),
"last_revision_date": "2009-02-14T01:31:33+02:00",
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Aug 24, 6:05 PM (4 d, 19 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3225268
Attached To
D6012: Store snapshot_ids as hexadecimal strings, not bytes
Event Timeline
Log In to Comment