Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9341984
D6043.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D6043.diff
View Options
diff --git a/swh/loader/mercurial/from_disk.py b/swh/loader/mercurial/from_disk.py
--- a/swh/loader/mercurial/from_disk.py
+++ b/swh/loader/mercurial/from_disk.py
@@ -47,7 +47,7 @@
TEMPORARY_DIR_PREFIX_PATTERN = "swh.loader.mercurial.from_disk"
EXTID_TYPE = "hg-nodeid"
-
+EXTID_VERSION: int = 1
T = TypeVar("T")
@@ -268,13 +268,13 @@
)
def _get_extids_for_targets(self, targets: List[bytes]) -> List[ExtID]:
- # Get all Mercurial ExtIDs for the targets in the latest snapshot
+ """Get all Mercurial ExtIDs for the targets in the latest snapshot"""
extids = [
extid
for extid in self.storage.extid_get_from_target(
identifiers.ObjectType.REVISION, targets
)
- if extid.extid_type == EXTID_TYPE
+ if extid.extid_type == EXTID_TYPE and extid.extid_version == EXTID_VERSION
]
if extids:
@@ -461,7 +461,11 @@
if from_cache is not None:
return from_cache
# The parent was not loaded in this run, get it from storage
- from_storage = self.storage.extid_get_from_extid(EXTID_TYPE, ids=[hg_nodeid])
+ from_storage = [
+ extid
+ for extid in self.storage.extid_get_from_extid(EXTID_TYPE, ids=[hg_nodeid])
+ if extid.extid_version == EXTID_VERSION
+ ]
msg = "Expected 1 match from storage for hg node %r, got %d"
assert len(from_storage) == 1, msg % (hg_nodeid.hex(), len(from_storage))
@@ -546,7 +550,14 @@
object_type=identifiers.ObjectType.REVISION, object_id=revision.id,
)
self.storage.extid_add(
- [ExtID(extid_type=EXTID_TYPE, extid=hg_nodeid, target=revision_swhid)]
+ [
+ ExtID(
+ extid_type=EXTID_TYPE,
+ extid_version=EXTID_VERSION,
+ extid=hg_nodeid,
+ target=revision_swhid,
+ )
+ ]
)
def store_release(self, name: bytes, target: Sha1Git) -> Sha1Git:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 12:25 PM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3218956
Attached To
D6043: [duplicated] Use versioned ExtIDs in main loader mercurial implementation
Event Timeline
Log In to Comment