swh.loader.mercurial 3.6.0__py3-none-any.whl → 3.6.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- swh/loader/mercurial/directory.py +1 -1
- swh/loader/mercurial/loader.py +19 -13
- swh/loader/mercurial/tests/test_directory.py +3 -3
- swh/loader/mercurial/tests/test_loader.py +24 -1
- {swh.loader.mercurial-3.6.0.dist-info → swh_loader_mercurial-3.6.2.dist-info}/METADATA +26 -25
- {swh.loader.mercurial-3.6.0.dist-info → swh_loader_mercurial-3.6.2.dist-info}/RECORD +11 -11
- {swh.loader.mercurial-3.6.0.dist-info → swh_loader_mercurial-3.6.2.dist-info}/WHEEL +1 -1
- {swh.loader.mercurial-3.6.0.dist-info → swh_loader_mercurial-3.6.2.dist-info}/entry_points.txt +0 -0
- {swh.loader.mercurial-3.6.0.dist-info → swh_loader_mercurial-3.6.2.dist-info/licenses}/AUTHORS +0 -0
- {swh.loader.mercurial-3.6.0.dist-info → swh_loader_mercurial-3.6.2.dist-info/licenses}/LICENSE +0 -0
- {swh.loader.mercurial-3.6.0.dist-info → swh_loader_mercurial-3.6.2.dist-info}/top_level.txt +0 -0
swh/loader/mercurial/loader.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2020-
|
|
1
|
+
# Copyright (C) 2020-2025 The Software Heritage developers
|
|
2
2
|
# See the AUTHORS file at the top-level directory of this distribution
|
|
3
3
|
# License: GNU General Public License version 3, or any later version
|
|
4
4
|
# See top-level LICENSE file for more information
|
|
@@ -42,6 +42,7 @@ from swh.model.model import (
|
|
|
42
42
|
Revision,
|
|
43
43
|
RevisionType,
|
|
44
44
|
Sha1Git,
|
|
45
|
+
SkippedContent,
|
|
45
46
|
Snapshot,
|
|
46
47
|
SnapshotBranch,
|
|
47
48
|
SnapshotTargetType,
|
|
@@ -284,9 +285,9 @@ class HgLoader(BaseLoader):
|
|
|
284
285
|
extid_version=EXTID_VERSION,
|
|
285
286
|
):
|
|
286
287
|
extids.append(extid)
|
|
287
|
-
self._revision_nodeid_to_sha1git[
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
self._revision_nodeid_to_sha1git[HgNodeId(extid.extid)] = (
|
|
289
|
+
extid.target.object_id
|
|
290
|
+
)
|
|
290
291
|
|
|
291
292
|
if extids:
|
|
292
293
|
# Filter out dangling extids, we need to load their target again
|
|
@@ -309,12 +310,12 @@ class HgLoader(BaseLoader):
|
|
|
309
310
|
|
|
310
311
|
for group_ids in grouper(hgnode_ids, n=1000):
|
|
311
312
|
for extid in self.storage.extid_get_from_extid(
|
|
312
|
-
EXTID_TYPE, group_ids, version=EXTID_VERSION
|
|
313
|
+
EXTID_TYPE, list(group_ids), version=EXTID_VERSION
|
|
313
314
|
):
|
|
314
315
|
extids.append(extid)
|
|
315
|
-
self._revision_nodeid_to_sha1git[
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
self._revision_nodeid_to_sha1git[HgNodeId(extid.extid)] = (
|
|
317
|
+
extid.target.object_id
|
|
318
|
+
)
|
|
318
319
|
|
|
319
320
|
if extids:
|
|
320
321
|
# Filter out dangling extids, we need to load their target again
|
|
@@ -702,11 +703,16 @@ class HgLoader(BaseLoader):
|
|
|
702
703
|
# See above use of `CorruptedRevision`
|
|
703
704
|
raise CorruptedRevision(hg_nodeid)
|
|
704
705
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
706
|
+
if self.max_content_size is not None and len(data) > self.max_content_size:
|
|
707
|
+
skipped_content = SkippedContent.from_data(
|
|
708
|
+
data, reason="Content too large"
|
|
709
|
+
)
|
|
710
|
+
self.storage.skipped_content_add([skipped_content])
|
|
711
|
+
sha1_git = skipped_content.sha1_git
|
|
712
|
+
else:
|
|
713
|
+
content = ModelContent.from_data(data)
|
|
714
|
+
self.storage.content_add([content])
|
|
715
|
+
sha1_git = content.sha1_git
|
|
710
716
|
self._content_hash_cache[cache_key] = sha1_git
|
|
711
717
|
|
|
712
718
|
# Here we make sure to return only necessary data.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2023 The Software Heritage developers
|
|
1
|
+
# Copyright (C) 2023-2025 The Software Heritage developers
|
|
2
2
|
# See the AUTHORS file at the top-level directory of this distribution
|
|
3
3
|
# License: GNU General Public License version 3, or any later version
|
|
4
4
|
# See top-level LICENSE file for more information
|
|
@@ -8,7 +8,7 @@ from pathlib import Path
|
|
|
8
8
|
|
|
9
9
|
import pytest
|
|
10
10
|
|
|
11
|
-
from swh.
|
|
11
|
+
from swh.core.nar import Nar
|
|
12
12
|
from swh.loader.exception import NotFound
|
|
13
13
|
from swh.loader.mercurial.directory import HgCheckoutLoader, clone_repository
|
|
14
14
|
from swh.loader.mercurial.hgutil import repository
|
|
@@ -166,7 +166,7 @@ def test_hg_directory_loader_hash_mismatch(swh_storage, datadir, tmp_path):
|
|
|
166
166
|
actual_result = loader.load()
|
|
167
167
|
|
|
168
168
|
# Ingestion fails because the hash checksums check failed
|
|
169
|
-
assert actual_result
|
|
169
|
+
assert actual_result["status"] == "failed"
|
|
170
170
|
assert_last_visit_matches(
|
|
171
171
|
swh_storage,
|
|
172
172
|
repo_url,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
# Copyright (C) 2020-
|
|
1
|
+
# Copyright (C) 2020-2025 The Software Heritage developers
|
|
2
2
|
# See the AUTHORS file at the top-level directory of this distribution
|
|
3
3
|
# License: GNU General Public License version 3, or any later version
|
|
4
4
|
# See top-level LICENSE file for more information
|
|
5
|
+
|
|
5
6
|
from datetime import datetime
|
|
6
7
|
from hashlib import sha1
|
|
7
8
|
import os
|
|
@@ -764,3 +765,25 @@ def test_loader_not_found_hg_repository(swh_storage, datadir, tmp_path):
|
|
|
764
765
|
status="not_found",
|
|
765
766
|
type="hg",
|
|
766
767
|
)
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
def test_loader_max_content_size(swh_storage, datadir, tmp_path):
|
|
771
|
+
"""Contents whose size is greater than 1 byte should be skipped."""
|
|
772
|
+
archive_name = "example"
|
|
773
|
+
archive_path = os.path.join(datadir, f"{archive_name}.tgz")
|
|
774
|
+
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path)
|
|
775
|
+
repo_path = repo_url.replace("file://", "")
|
|
776
|
+
|
|
777
|
+
loader = HgLoader(swh_storage, repo_path, max_content_size=1)
|
|
778
|
+
|
|
779
|
+
assert loader.load() == {"status": "eventful"}
|
|
780
|
+
assert get_stats(loader.storage) == {
|
|
781
|
+
"content": 0,
|
|
782
|
+
"directory": 16,
|
|
783
|
+
"origin": 1,
|
|
784
|
+
"origin_visit": 1,
|
|
785
|
+
"release": 0,
|
|
786
|
+
"revision": 9,
|
|
787
|
+
"skipped_content": 7,
|
|
788
|
+
"snapshot": 1,
|
|
789
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: swh.loader.mercurial
|
|
3
|
-
Version: 3.6.
|
|
3
|
+
Version: 3.6.2
|
|
4
4
|
Summary: Software Heritage Mercurial Loader
|
|
5
5
|
Author-email: Software Heritage developers <swh-devel@inria.fr>
|
|
6
6
|
Project-URL: Homepage, https://gitlab.softwareheritage.org/swh/devel/swh-loader-mercurial
|
|
@@ -13,7 +13,7 @@ Classifier: Intended Audience :: Developers
|
|
|
13
13
|
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
15
|
Classifier: Development Status :: 4 - Beta
|
|
16
|
-
Requires-Python: >=3.
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
17
|
Description-Content-Type: text/x-rst
|
|
18
18
|
License-File: LICENSE
|
|
19
19
|
License-File: AUTHORS
|
|
@@ -22,29 +22,30 @@ Requires-Dist: patool
|
|
|
22
22
|
Requires-Dist: python-dateutil
|
|
23
23
|
Requires-Dist: python-hglib
|
|
24
24
|
Requires-Dist: mercurial
|
|
25
|
-
Requires-Dist: swh.model
|
|
26
|
-
Requires-Dist: swh.storage
|
|
27
|
-
Requires-Dist: swh.scheduler
|
|
28
|
-
Requires-Dist: swh.loader.core
|
|
25
|
+
Requires-Dist: swh.model>=6.13.0
|
|
26
|
+
Requires-Dist: swh.storage>=2.4.1
|
|
27
|
+
Requires-Dist: swh.scheduler>=0.0.39
|
|
28
|
+
Requires-Dist: swh.loader.core>=5.24.0
|
|
29
29
|
Provides-Extra: testing
|
|
30
|
-
Requires-Dist: click
|
|
31
|
-
Requires-Dist: patool
|
|
32
|
-
Requires-Dist: python-dateutil
|
|
33
|
-
Requires-Dist: python-hglib
|
|
34
|
-
Requires-Dist: mercurial
|
|
35
|
-
Requires-Dist: swh.model
|
|
36
|
-
Requires-Dist: swh.storage
|
|
37
|
-
Requires-Dist: swh.scheduler
|
|
38
|
-
Requires-Dist: swh.loader.core
|
|
39
|
-
Requires-Dist:
|
|
40
|
-
Requires-Dist: pytest
|
|
41
|
-
Requires-Dist:
|
|
42
|
-
Requires-Dist: swh.
|
|
43
|
-
Requires-Dist: swh.
|
|
44
|
-
Requires-Dist: swh.
|
|
45
|
-
Requires-Dist:
|
|
46
|
-
Requires-Dist: types-deprecated
|
|
47
|
-
Requires-Dist: types-python-dateutil
|
|
30
|
+
Requires-Dist: click; extra == "testing"
|
|
31
|
+
Requires-Dist: patool; extra == "testing"
|
|
32
|
+
Requires-Dist: python-dateutil; extra == "testing"
|
|
33
|
+
Requires-Dist: python-hglib; extra == "testing"
|
|
34
|
+
Requires-Dist: mercurial; extra == "testing"
|
|
35
|
+
Requires-Dist: swh.model>=6.13.0; extra == "testing"
|
|
36
|
+
Requires-Dist: swh.storage>=2.4.1; extra == "testing"
|
|
37
|
+
Requires-Dist: swh.scheduler>=0.0.39; extra == "testing"
|
|
38
|
+
Requires-Dist: swh.loader.core>=5.24.0; extra == "testing"
|
|
39
|
+
Requires-Dist: celery-types; extra == "testing"
|
|
40
|
+
Requires-Dist: pytest; extra == "testing"
|
|
41
|
+
Requires-Dist: pytest-mock; extra == "testing"
|
|
42
|
+
Requires-Dist: swh.core[http]>=4.5.0; extra == "testing"
|
|
43
|
+
Requires-Dist: swh.loader.core[testing]>=5.24.0; extra == "testing"
|
|
44
|
+
Requires-Dist: swh.scheduler[pytest]>=3.1.0; extra == "testing"
|
|
45
|
+
Requires-Dist: swh.storage[pytest]>=3.1.0; extra == "testing"
|
|
46
|
+
Requires-Dist: types-deprecated; extra == "testing"
|
|
47
|
+
Requires-Dist: types-python-dateutil; extra == "testing"
|
|
48
|
+
Dynamic: license-file
|
|
48
49
|
|
|
49
50
|
swh-loader-mercurial
|
|
50
51
|
====================
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
swh/loader/mercurial/__init__.py,sha256=ioPrVqbM_-w8sEwWUKEw9jCTbzQTkWwMaJM77D7YItM,745
|
|
2
2
|
swh/loader/mercurial/archive_extract.py,sha256=gMSxvwIxZu5-Ei9a7ZeNCjZV-wBMIBTGonUutZ16yhE,1981
|
|
3
3
|
swh/loader/mercurial/converters.py,sha256=qrL63I-6ezmICJa7cTB_jlS0kiPfHGL3xH8NXJTF1nU,1040
|
|
4
|
-
swh/loader/mercurial/directory.py,sha256=
|
|
4
|
+
swh/loader/mercurial/directory.py,sha256=UA5Hie6cSgGd21LE-QPPVE7aeiSzvpndzIMNULG7EUI,3354
|
|
5
5
|
swh/loader/mercurial/hgutil.py,sha256=tg-QX2jRod9kUZ-nGPv30Km11Z1hTf4zINYL1T7eakk,5142
|
|
6
6
|
swh/loader/mercurial/identify.py,sha256=9QQqI6MywQiZ62bm0JD_TNMjMlYdqJPzmHGFsl3cWGM,16604
|
|
7
|
-
swh/loader/mercurial/loader.py,sha256=
|
|
7
|
+
swh/loader/mercurial/loader.py,sha256=t2DFn75NfHLFWdEGhcQFe1f7c6as1CRxOYAqUu_1zRA,30036
|
|
8
8
|
swh/loader/mercurial/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
|
|
9
9
|
swh/loader/mercurial/tasks.py,sha256=cN41ntODtUUR9kk9Q7n9onfNMPaewmKDuB5RfsnSu6Y,1468
|
|
10
10
|
swh/loader/mercurial/utils.py,sha256=jDaWupPQf16KAbsTfyuJZGiE5D72iLwgi7gY0XN4ZMY,1462
|
|
@@ -12,9 +12,9 @@ swh/loader/mercurial/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
12
12
|
swh/loader/mercurial/tests/conftest.py,sha256=xMFVE0tp9bbspeywcIpS5gDjeZF_SMWcIgvyrsybuXQ,1671
|
|
13
13
|
swh/loader/mercurial/tests/loader_checker.py,sha256=lcOoO4viwqfUgKKm9sUBhw5_uyS93pyT-BMWDnPxgzU,2353
|
|
14
14
|
swh/loader/mercurial/tests/test_converters.py,sha256=5r02CYtZ85xdK00wcfDjmWJo1Qr4BHOYHtjxWaHOVhY,2155
|
|
15
|
-
swh/loader/mercurial/tests/test_directory.py,sha256=
|
|
15
|
+
swh/loader/mercurial/tests/test_directory.py,sha256=rs-p4lRApMo4ayiTe-2z2HMnro4AOO_Pfj6WH1SGY8w,6861
|
|
16
16
|
swh/loader/mercurial/tests/test_identify.py,sha256=Dp21Ic8b8HMt3hcdqHzPuTpInTk4WLD-yjf7u79PJZM,3016
|
|
17
|
-
swh/loader/mercurial/tests/test_loader.py,sha256=
|
|
17
|
+
swh/loader/mercurial/tests/test_loader.py,sha256=D4DdHTO_-zA6rK06b829mF1tl8Io3RJ9-H7WX2HTHCA,27002
|
|
18
18
|
swh/loader/mercurial/tests/test_tasks.py,sha256=7vB4HSlmN7QKyA4p7ZnKRCmb4PgsY0qnW96KUJVjuzs,1970
|
|
19
19
|
swh/loader/mercurial/tests/test_tasks_directory.py,sha256=iBi1FdKvk4cIuy9_AXD6hS9pEPkZk1Ex2A1LNzIMPkA,1438
|
|
20
20
|
swh/loader/mercurial/tests/data/anomad-d.tgz,sha256=YRDmphGrPdtkD5Ysra_fK83XNQY5EpoyEp700nOL2yQ,2757941
|
|
@@ -33,10 +33,10 @@ swh/loader/mercurial/tests/data/the-sandbox.json,sha256=baIwB2DbiXkwzxoA0Z8vDFlt
|
|
|
33
33
|
swh/loader/mercurial/tests/data/the-sandbox.tgz,sha256=MkJ6Nx_CDRkFlox9dcfq-I2ktFa2niAeAT2f7ClvrtY,13309
|
|
34
34
|
swh/loader/mercurial/tests/data/transplant.json,sha256=h9akY1VS5nv5LOoiZuiJ3tg9ikkeciqdpjpeyGFR_p0,633
|
|
35
35
|
swh/loader/mercurial/tests/data/transplant.tgz,sha256=eoS3hnKcIOkNrx3pj8lj3lMP7_V8EEjg4rmNI0qO1Vs,3206
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
swh_loader_mercurial-3.6.2.dist-info/licenses/AUTHORS,sha256=CfkR1t8Z3y1NSRjmzMBmWzN55CEqCDCIXp1XtqzAjf4,117
|
|
37
|
+
swh_loader_mercurial-3.6.2.dist-info/licenses/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
|
38
|
+
swh_loader_mercurial-3.6.2.dist-info/METADATA,sha256=Jgd4h1TQfBSIXFfSVh3PdN3gAWmzcLxVZWwNeCTzEeY,3140
|
|
39
|
+
swh_loader_mercurial-3.6.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
40
|
+
swh_loader_mercurial-3.6.2.dist-info/entry_points.txt,sha256=KR1-Noi4WbxrdetuNh-QSOSVVp12_NT04aa5nK3YO5o,202
|
|
41
|
+
swh_loader_mercurial-3.6.2.dist-info/top_level.txt,sha256=8XlamXOHbQHPR7Tn7kZa8F4ufiLuK-BL_bZje5MY9hw,4
|
|
42
|
+
swh_loader_mercurial-3.6.2.dist-info/RECORD,,
|
{swh.loader.mercurial-3.6.0.dist-info → swh_loader_mercurial-3.6.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{swh.loader.mercurial-3.6.0.dist-info → swh_loader_mercurial-3.6.2.dist-info/licenses}/AUTHORS
RENAMED
|
File without changes
|
{swh.loader.mercurial-3.6.0.dist-info → swh_loader_mercurial-3.6.2.dist-info/licenses}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|