swh.loader.mercurial 3.5.1__py3-none-any.whl → 3.5.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 +14 -3
- swh/loader/mercurial/tests/test_directory.py +14 -3
- {swh.loader.mercurial-3.5.1.dist-info → swh.loader.mercurial-3.5.2.dist-info}/METADATA +1 -1
- {swh.loader.mercurial-3.5.1.dist-info → swh.loader.mercurial-3.5.2.dist-info}/RECORD +9 -9
- {swh.loader.mercurial-3.5.1.dist-info → swh.loader.mercurial-3.5.2.dist-info}/AUTHORS +0 -0
- {swh.loader.mercurial-3.5.1.dist-info → swh.loader.mercurial-3.5.2.dist-info}/LICENSE +0 -0
- {swh.loader.mercurial-3.5.1.dist-info → swh.loader.mercurial-3.5.2.dist-info}/WHEEL +0 -0
- {swh.loader.mercurial-3.5.1.dist-info → swh.loader.mercurial-3.5.2.dist-info}/entry_points.txt +0 -0
- {swh.loader.mercurial-3.5.1.dist-info → swh.loader.mercurial-3.5.2.dist-info}/top_level.txt +0 -0
|
@@ -3,14 +3,16 @@
|
|
|
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 os.path import basename
|
|
7
8
|
from pathlib import Path
|
|
8
9
|
import tempfile
|
|
9
|
-
from typing import Iterator
|
|
10
|
+
from typing import Any, Iterable, Iterator
|
|
10
11
|
|
|
11
12
|
from swh.loader.core.loader import BaseDirectoryLoader
|
|
12
13
|
from swh.loader.mercurial.hgutil import clone
|
|
13
14
|
from swh.loader.mercurial.utils import raise_not_found_repository
|
|
15
|
+
from swh.model.from_disk import ignore_empty_directories, ignore_named_directories
|
|
14
16
|
from swh.model.model import Snapshot, SnapshotBranch, TargetType
|
|
15
17
|
|
|
16
18
|
|
|
@@ -40,6 +42,13 @@ def clone_repository(repo_url: str, hg_changeset: str, target: Path) -> Path:
|
|
|
40
42
|
return local_clone_dir
|
|
41
43
|
|
|
42
44
|
|
|
45
|
+
def list_hg_tree(dirpath: bytes, dirname: bytes, entries: Iterable[Any]) -> bool:
|
|
46
|
+
"""List a mercurial tree. This ignores any repo_path/.hg/* and empty folders."""
|
|
47
|
+
return ignore_named_directories([b".hg"])(
|
|
48
|
+
dirpath, dirname, entries
|
|
49
|
+
) and ignore_empty_directories(dirpath, dirname, entries)
|
|
50
|
+
|
|
51
|
+
|
|
43
52
|
class HgCheckoutLoader(BaseDirectoryLoader):
|
|
44
53
|
"""Hg directory loader in charge of ingesting a mercurial tree at a specific
|
|
45
54
|
changeset, tag or branch into the swh archive.
|
|
@@ -63,10 +72,12 @@ class HgCheckoutLoader(BaseDirectoryLoader):
|
|
|
63
72
|
|
|
64
73
|
def __init__(self, *args, **kwargs):
|
|
65
74
|
self.hg_changeset = kwargs.pop("ref")
|
|
66
|
-
super().__init__(*args, **kwargs)
|
|
75
|
+
super().__init__(*args, dir_filter=list_hg_tree, **kwargs)
|
|
67
76
|
|
|
68
77
|
def fetch_artifact(self) -> Iterator[Path]:
|
|
69
|
-
with tempfile.TemporaryDirectory(
|
|
78
|
+
with tempfile.TemporaryDirectory(
|
|
79
|
+
suffix="-" + datetime.now().isoformat()
|
|
80
|
+
) as tmpdir:
|
|
70
81
|
repo = clone_repository(
|
|
71
82
|
self.origin.url, self.hg_changeset, target=Path(tmpdir)
|
|
72
83
|
)
|
|
@@ -126,14 +126,22 @@ def test_hg_directory_loader(
|
|
|
126
126
|
|
|
127
127
|
# Ensure the extids got stored as well
|
|
128
128
|
extids = fetch_extids_from_checksums(
|
|
129
|
-
loader.storage,
|
|
129
|
+
loader.storage,
|
|
130
|
+
checksum_layout="nar",
|
|
131
|
+
checksums=checksums,
|
|
132
|
+
extid_version=loader.extid_version,
|
|
130
133
|
)
|
|
131
134
|
|
|
132
135
|
assert len(extids) == len(checksums)
|
|
133
136
|
for extid in extids:
|
|
134
137
|
assert extid.extid_type == f"nar-{hash_algo}"
|
|
135
|
-
assert extid.extid_version ==
|
|
138
|
+
assert extid.extid_version == loader.extid_version
|
|
136
139
|
assert extid.extid == hash_to_bytes(checksums[hash_algo])
|
|
140
|
+
assert ".hg" not in [
|
|
141
|
+
entry["name"]
|
|
142
|
+
for entry in swh_storage.directory_ls(extid.target.object_id)
|
|
143
|
+
if entry["type"] == "dir"
|
|
144
|
+
]
|
|
137
145
|
|
|
138
146
|
|
|
139
147
|
def test_hg_directory_loader_hash_mismatch(swh_storage, datadir, tmp_path):
|
|
@@ -179,7 +187,10 @@ def test_hg_directory_loader_hash_mismatch(swh_storage, datadir, tmp_path):
|
|
|
179
187
|
|
|
180
188
|
# Ensure no extids got stored
|
|
181
189
|
extids = fetch_extids_from_checksums(
|
|
182
|
-
loader.storage,
|
|
190
|
+
loader.storage,
|
|
191
|
+
checksum_layout="nar",
|
|
192
|
+
checksums=faulty_checksums,
|
|
193
|
+
extid_version=loader.extid_version,
|
|
183
194
|
)
|
|
184
195
|
assert extids == []
|
|
185
196
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: swh.loader.mercurial
|
|
3
|
-
Version: 3.5.
|
|
3
|
+
Version: 3.5.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
|
|
@@ -1,7 +1,7 @@
|
|
|
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=uReb_gSxRNKn79NCYpv5c8qvrzUM9iNEN6vmT1qT2us,3331
|
|
5
5
|
swh/loader/mercurial/hgutil.py,sha256=tg-QX2jRod9kUZ-nGPv30Km11Z1hTf4zINYL1T7eakk,5142
|
|
6
6
|
swh/loader/mercurial/identify.py,sha256=s6soJVvPpSwePYNRj3_Eo9WmVJvgM1XT2-xfep7pyjE,16613
|
|
7
7
|
swh/loader/mercurial/loader.py,sha256=fi3gaWFVTkbc9nslgPv7JNoUYM-xEClIHL__m45bCyg,29492
|
|
@@ -12,7 +12,7 @@ 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=3BPLz6PoYH-_xf8qyMibNdXyTti3D2sDMoUTMYupsY0,6865
|
|
16
16
|
swh/loader/mercurial/tests/test_identify.py,sha256=Dp21Ic8b8HMt3hcdqHzPuTpInTk4WLD-yjf7u79PJZM,3016
|
|
17
17
|
swh/loader/mercurial/tests/test_loader.py,sha256=hoqe_mw-toRTl0Y6hU9f15TnZ8XEpCDPifeg_PT_hl4,26197
|
|
18
18
|
swh/loader/mercurial/tests/test_tasks.py,sha256=7vB4HSlmN7QKyA4p7ZnKRCmb4PgsY0qnW96KUJVjuzs,1970
|
|
@@ -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
|
-
swh.loader.mercurial-3.5.
|
|
37
|
-
swh.loader.mercurial-3.5.
|
|
38
|
-
swh.loader.mercurial-3.5.
|
|
39
|
-
swh.loader.mercurial-3.5.
|
|
40
|
-
swh.loader.mercurial-3.5.
|
|
41
|
-
swh.loader.mercurial-3.5.
|
|
42
|
-
swh.loader.mercurial-3.5.
|
|
36
|
+
swh.loader.mercurial-3.5.2.dist-info/AUTHORS,sha256=CfkR1t8Z3y1NSRjmzMBmWzN55CEqCDCIXp1XtqzAjf4,117
|
|
37
|
+
swh.loader.mercurial-3.5.2.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
|
38
|
+
swh.loader.mercurial-3.5.2.dist-info/METADATA,sha256=NyMzLFFajZhAc35N0GLxyUHAEwBLjoS9ASJ0FOS_o54,3072
|
|
39
|
+
swh.loader.mercurial-3.5.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
40
|
+
swh.loader.mercurial-3.5.2.dist-info/entry_points.txt,sha256=KR1-Noi4WbxrdetuNh-QSOSVVp12_NT04aa5nK3YO5o,202
|
|
41
|
+
swh.loader.mercurial-3.5.2.dist-info/top_level.txt,sha256=8XlamXOHbQHPR7Tn7kZa8F4ufiLuK-BL_bZje5MY9hw,4
|
|
42
|
+
swh.loader.mercurial-3.5.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swh.loader.mercurial-3.5.1.dist-info → swh.loader.mercurial-3.5.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|