swh.loader.mercurial 3.5.2__py3-none-any.whl → 3.6.0__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.
@@ -13,7 +13,7 @@ from swh.loader.core.loader import BaseDirectoryLoader
13
13
  from swh.loader.mercurial.hgutil import clone
14
14
  from swh.loader.mercurial.utils import raise_not_found_repository
15
15
  from swh.model.from_disk import ignore_empty_directories, ignore_named_directories
16
- from swh.model.model import Snapshot, SnapshotBranch, TargetType
16
+ from swh.model.model import Snapshot, SnapshotBranch, SnapshotTargetType
17
17
 
18
18
 
19
19
  def clone_repository(repo_url: str, hg_changeset: str, target: Path) -> Path:
@@ -72,7 +72,7 @@ class HgCheckoutLoader(BaseDirectoryLoader):
72
72
 
73
73
  def __init__(self, *args, **kwargs):
74
74
  self.hg_changeset = kwargs.pop("ref")
75
- super().__init__(*args, dir_filter=list_hg_tree, **kwargs)
75
+ super().__init__(*args, path_filter=list_hg_tree, **kwargs)
76
76
 
77
77
  def fetch_artifact(self) -> Iterator[Path]:
78
78
  with tempfile.TemporaryDirectory(
@@ -90,11 +90,11 @@ class HgCheckoutLoader(BaseDirectoryLoader):
90
90
  return Snapshot(
91
91
  branches={
92
92
  b"HEAD": SnapshotBranch(
93
- target_type=TargetType.ALIAS,
93
+ target_type=SnapshotTargetType.ALIAS,
94
94
  target=branch_name,
95
95
  ),
96
96
  branch_name: SnapshotBranch(
97
- target_type=TargetType.DIRECTORY,
97
+ target_type=SnapshotTargetType.DIRECTORY,
98
98
  target=self.directory.hash,
99
99
  ),
100
100
  }
@@ -414,8 +414,7 @@ def identify_release(
414
414
  node_id_2_swhid: An optional cache mapping hg node ids to SWHIDs
415
415
  If not provided it will be computed using `identify_revision`.
416
416
  """
417
- from swh.model.model import ObjectType as ModelObjectType
418
- from swh.model.model import Release
417
+ from swh.model.model import Release, ReleaseTargetType
419
418
 
420
419
  if node_id_2_swhid is None:
421
420
  node_id_2_swhid = {
@@ -427,7 +426,7 @@ def identify_release(
427
426
  data = {
428
427
  "name": tag.name,
429
428
  "target": node_id_2_swhid[tag.node_id].object_id,
430
- "target_type": ModelObjectType.REVISION.value,
429
+ "target_type": ReleaseTargetType.REVISION.value,
431
430
  "message": None,
432
431
  "metadata": None,
433
432
  "synthetic": False,
@@ -458,7 +457,7 @@ def identify_snapshot(
458
457
  release: an optional list of `ReleaseIdentity`.
459
458
  If not provided it will be computed using `identify_release`.
460
459
  """
461
- from swh.model.model import Snapshot, TargetType
460
+ from swh.model.model import Snapshot, SnapshotTargetType
462
461
 
463
462
  if node_id_2_swhid is None:
464
463
  node_id_2_swhid = {
@@ -473,21 +472,21 @@ def identify_snapshot(
473
472
  tip = hg.tip()
474
473
  branches[b"HEAD"] = {
475
474
  "target": tip.branch(),
476
- "target_type": TargetType.ALIAS.value,
475
+ "target_type": SnapshotTargetType.ALIAS.value,
477
476
  }
478
477
 
479
478
  for branch in hg.branches():
480
479
  assert node_id_2_swhid[branch.node_id].object_type == ObjectType.REVISION
481
480
  branches[branch.name] = {
482
481
  "target": node_id_2_swhid[branch.node_id].object_id,
483
- "target_type": TargetType.REVISION.value,
482
+ "target_type": SnapshotTargetType.REVISION.value,
484
483
  }
485
484
 
486
485
  for release in releases:
487
486
  assert release.swhid.object_type == ObjectType.RELEASE
488
487
  branches[release.name] = {
489
488
  "target": release.swhid.object_id,
490
- "target_type": TargetType.RELEASE.value,
489
+ "target_type": SnapshotTargetType.RELEASE.value,
491
490
  }
492
491
 
493
492
  return Snapshot.from_dict({"branches": branches}).swhid()
@@ -44,7 +44,7 @@ from swh.model.model import (
44
44
  Sha1Git,
45
45
  Snapshot,
46
46
  SnapshotBranch,
47
- TargetType,
47
+ SnapshotTargetType,
48
48
  TimestampWithTimezone,
49
49
  )
50
50
  from swh.model.model import Content as ModelContent
@@ -242,7 +242,11 @@ class HgLoader(BaseLoader):
242
242
  # Set here to allow multiple calls to load on the same loader instance
243
243
  self._latest_heads = []
244
244
 
245
- latest_snapshot = snapshot_get_latest(self.storage, self.origin.url)
245
+ latest_snapshot = snapshot_get_latest(
246
+ self.storage,
247
+ self.origin.url,
248
+ visit_type=self.visit_type,
249
+ )
246
250
  if latest_snapshot:
247
251
  self._set_recorded_state(latest_snapshot)
248
252
 
@@ -258,9 +262,9 @@ class HgLoader(BaseLoader):
258
262
  tags = []
259
263
 
260
264
  for branch in latest_snapshot.branches.values():
261
- if branch.target_type == TargetType.REVISION:
265
+ if branch.target_type == SnapshotTargetType.REVISION:
262
266
  heads.append(branch.target)
263
- elif branch.target_type == TargetType.RELEASE:
267
+ elif branch.target_type == SnapshotTargetType.RELEASE:
264
268
  tags.append(branch.target)
265
269
 
266
270
  self._latest_heads.extend(
@@ -442,21 +446,21 @@ class HgLoader(BaseLoader):
442
446
  target = self.get_revision_id_from_hg_nodeid(hg_nodeid)
443
447
  snapshot_branches[label] = SnapshotBranch(
444
448
  target=self.store_release(tag_name, target),
445
- target_type=TargetType.RELEASE,
449
+ target_type=SnapshotTargetType.RELEASE,
446
450
  )
447
451
 
448
452
  for branch_name, node_id in branching_info.tips.items():
449
453
  name = b"branch-tip/%s" % branch_name
450
454
  target = self.get_revision_id_from_hg_nodeid(node_id)
451
455
  snapshot_branches[name] = SnapshotBranch(
452
- target=target, target_type=TargetType.REVISION
456
+ target=target, target_type=SnapshotTargetType.REVISION
453
457
  )
454
458
 
455
459
  for bookmark_name, node_id in branching_info.bookmarks.items():
456
460
  name = b"bookmarks/%s" % bookmark_name
457
461
  target = self.get_revision_id_from_hg_nodeid(node_id)
458
462
  snapshot_branches[name] = SnapshotBranch(
459
- target=target, target_type=TargetType.REVISION
463
+ target=target, target_type=SnapshotTargetType.REVISION
460
464
  )
461
465
 
462
466
  for branch_name, branch_heads in branching_info.open_heads.items():
@@ -464,7 +468,7 @@ class HgLoader(BaseLoader):
464
468
  name = b"branch-heads/%s/%d" % (branch_name, index)
465
469
  target = self.get_revision_id_from_hg_nodeid(head)
466
470
  snapshot_branches[name] = SnapshotBranch(
467
- target=target, target_type=TargetType.REVISION
471
+ target=target, target_type=SnapshotTargetType.REVISION
468
472
  )
469
473
 
470
474
  for branch_name, closed_heads in branching_info.closed_heads.items():
@@ -472,7 +476,7 @@ class HgLoader(BaseLoader):
472
476
  name = b"branch-closed-heads/%s/%d" % (branch_name, index)
473
477
  target = self.get_revision_id_from_hg_nodeid(head)
474
478
  snapshot_branches[name] = SnapshotBranch(
475
- target=target, target_type=TargetType.REVISION
479
+ target=target, target_type=SnapshotTargetType.REVISION
476
480
  )
477
481
 
478
482
  # If the repo is broken enough or if it has none of the "normal" default
@@ -481,7 +485,7 @@ class HgLoader(BaseLoader):
481
485
  if default_branch_alias is not None:
482
486
  snapshot_branches[b"HEAD"] = SnapshotBranch(
483
487
  target=default_branch_alias,
484
- target_type=TargetType.ALIAS,
488
+ target_type=SnapshotTargetType.ALIAS,
485
489
  )
486
490
  snapshot = Snapshot(branches=snapshot_branches)
487
491
  self.storage.snapshot_add([snapshot])
@@ -21,7 +21,7 @@ from swh.loader.tests import (
21
21
  )
22
22
  from swh.model.from_disk import Content, DentryPerms
23
23
  from swh.model.hashutil import hash_to_bytes, hash_to_hex
24
- from swh.model.model import RevisionType, Snapshot, SnapshotBranch, TargetType
24
+ from swh.model.model import RevisionType, Snapshot, SnapshotBranch, SnapshotTargetType
25
25
  from swh.model.swhids import ObjectType
26
26
  from swh.storage import get_storage
27
27
  from swh.storage.algos.snapshot import snapshot_get_latest
@@ -141,11 +141,13 @@ def test_loader_hg_new_visit_no_release(swh_storage, datadir, tmp_path):
141
141
  mapping.update(tips)
142
142
 
143
143
  expected_branches = {
144
- k: SnapshotBranch(target=hash_to_bytes(v), target_type=TargetType.REVISION)
144
+ k: SnapshotBranch(
145
+ target=hash_to_bytes(v), target_type=SnapshotTargetType.REVISION
146
+ )
145
147
  for k, v in mapping.items()
146
148
  }
147
149
  expected_branches[b"HEAD"] = SnapshotBranch(
148
- target=b"branch-tip/default", target_type=TargetType.ALIAS
150
+ target=b"branch-tip/default", target_type=SnapshotTargetType.ALIAS
149
151
  )
150
152
 
151
153
  expected_snapshot = Snapshot(
@@ -238,15 +240,15 @@ def test_loader_hg_new_visit_with_release(swh_storage, datadir, tmp_path):
238
240
  branches={
239
241
  b"branch-tip/default": SnapshotBranch(
240
242
  target=tip_revision_default,
241
- target_type=TargetType.REVISION,
243
+ target_type=SnapshotTargetType.REVISION,
242
244
  ),
243
245
  b"tags/0.1": SnapshotBranch(
244
246
  target=tip_release,
245
- target_type=TargetType.RELEASE,
247
+ target_type=SnapshotTargetType.RELEASE,
246
248
  ),
247
249
  b"HEAD": SnapshotBranch(
248
250
  target=b"branch-tip/default",
249
- target_type=TargetType.ALIAS,
251
+ target_type=SnapshotTargetType.ALIAS,
250
252
  ),
251
253
  },
252
254
  )
@@ -620,7 +622,7 @@ def test_load_repo_check_extids_write_version(swh_storage, datadir, tmp_path):
620
622
  revision_ids = [
621
623
  branch.target
622
624
  for branch in snapshot.branches.values()
623
- if branch.target_type == TargetType.REVISION
625
+ if branch.target_type == SnapshotTargetType.REVISION
624
626
  ]
625
627
 
626
628
  assert len(revision_ids) > 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: swh.loader.mercurial
3
- Version: 3.5.2
3
+ Version: 3.6.0
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
@@ -22,23 +22,24 @@ 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 >=2.6.1
26
- Requires-Dist: swh.storage >=0.37.0
25
+ Requires-Dist: swh.model >=6.13.0
26
+ Requires-Dist: swh.storage >=2.4.1
27
27
  Requires-Dist: swh.scheduler >=0.0.39
28
- Requires-Dist: swh.loader.core >=5.14.2
28
+ Requires-Dist: swh.loader.core >=5.18.1
29
29
  Provides-Extra: testing
30
30
  Requires-Dist: click ; extra == 'testing'
31
31
  Requires-Dist: patool ; extra == 'testing'
32
32
  Requires-Dist: python-dateutil ; extra == 'testing'
33
33
  Requires-Dist: python-hglib ; extra == 'testing'
34
34
  Requires-Dist: mercurial ; extra == 'testing'
35
- Requires-Dist: swh.model >=2.6.1 ; extra == 'testing'
36
- Requires-Dist: swh.storage >=0.37.0 ; extra == 'testing'
35
+ Requires-Dist: swh.model >=6.13.0 ; extra == 'testing'
36
+ Requires-Dist: swh.storage >=2.4.1 ; extra == 'testing'
37
37
  Requires-Dist: swh.scheduler >=0.0.39 ; extra == 'testing'
38
- Requires-Dist: swh.loader.core >=5.14.2 ; extra == 'testing'
38
+ Requires-Dist: swh.loader.core >=5.18.1 ; extra == 'testing'
39
39
  Requires-Dist: pytest ; extra == 'testing'
40
40
  Requires-Dist: pytest-mock ; extra == 'testing'
41
41
  Requires-Dist: swh.core[http] >=0.0.61 ; extra == 'testing'
42
+ Requires-Dist: swh.loader.core[testing] >=5.18.1 ; extra == 'testing'
42
43
  Requires-Dist: swh.scheduler[testing] >=0.5.0 ; extra == 'testing'
43
44
  Requires-Dist: swh.storage[testing] ; extra == 'testing'
44
45
  Requires-Dist: types-click ; extra == 'testing'
@@ -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=uReb_gSxRNKn79NCYpv5c8qvrzUM9iNEN6vmT1qT2us,3331
4
+ swh/loader/mercurial/directory.py,sha256=PMltrtpRFsBayOn0aw1Aj3Py-eBxyRl-rbR6250vIlw,3356
5
5
  swh/loader/mercurial/hgutil.py,sha256=tg-QX2jRod9kUZ-nGPv30Km11Z1hTf4zINYL1T7eakk,5142
6
- swh/loader/mercurial/identify.py,sha256=s6soJVvPpSwePYNRj3_Eo9WmVJvgM1XT2-xfep7pyjE,16613
7
- swh/loader/mercurial/loader.py,sha256=fi3gaWFVTkbc9nslgPv7JNoUYM-xEClIHL__m45bCyg,29492
6
+ swh/loader/mercurial/identify.py,sha256=9QQqI6MywQiZ62bm0JD_TNMjMlYdqJPzmHGFsl3cWGM,16604
7
+ swh/loader/mercurial/loader.py,sha256=3910ULFZmY-Q4rUhTsMggz-2OVmpU8UHiljfwgjFIKI,29639
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
@@ -14,7 +14,7 @@ swh/loader/mercurial/tests/loader_checker.py,sha256=lcOoO4viwqfUgKKm9sUBhw5_uyS9
14
14
  swh/loader/mercurial/tests/test_converters.py,sha256=5r02CYtZ85xdK00wcfDjmWJo1Qr4BHOYHtjxWaHOVhY,2155
15
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
- swh/loader/mercurial/tests/test_loader.py,sha256=hoqe_mw-toRTl0Y6hU9f15TnZ8XEpCDPifeg_PT_hl4,26197
17
+ swh/loader/mercurial/tests/test_loader.py,sha256=_xw_NuBFIbruBfe86jXARbI8ogbeBM5WNFd6UOR5-60,26275
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
- 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,,
36
+ swh.loader.mercurial-3.6.0.dist-info/AUTHORS,sha256=CfkR1t8Z3y1NSRjmzMBmWzN55CEqCDCIXp1XtqzAjf4,117
37
+ swh.loader.mercurial-3.6.0.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
38
+ swh.loader.mercurial-3.6.0.dist-info/METADATA,sha256=DPpOQG5bBuBf_rD5mxJfZJUDLqEu3SRaq-HSUAF51xA,3142
39
+ swh.loader.mercurial-3.6.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
40
+ swh.loader.mercurial-3.6.0.dist-info/entry_points.txt,sha256=KR1-Noi4WbxrdetuNh-QSOSVVp12_NT04aa5nK3YO5o,202
41
+ swh.loader.mercurial-3.6.0.dist-info/top_level.txt,sha256=8XlamXOHbQHPR7Tn7kZa8F4ufiLuK-BL_bZje5MY9hw,4
42
+ swh.loader.mercurial-3.6.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5