Skip to content
Snippets Groups Projects
Commit 92441e90 authored by Raphaël Gomès's avatar Raphaël Gomès
Browse files

Replace old loader with the new one

This is the minimal amount of code needed to switch from the old one to
the new one. If the new loader proves to be good enough, we may remove
the old one entirely.
parent 4630de8a
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ from celery import shared_task
from swh.loader.mercurial.utils import parse_visit_date
from .loader import HgArchiveBundle20Loader, HgBundle20Loader
from .from_disk import HgArchiveLoaderFromDisk, HgLoaderFromDisk
@shared_task(name=__name__ + ".LoadMercurial")
......@@ -20,11 +20,11 @@ def load_hg(
Import a mercurial tarball into swh.
Args: see :func:`HgBundle20Loader.load`.
Args: see :func:`HgLoaderFromDisk.load`.
"""
loader = HgBundle20Loader.from_configfile(
loader = HgLoaderFromDisk.from_configfile(
url=url, directory=directory, visit_date=parse_visit_date(visit_date)
)
return loader.load()
......@@ -36,9 +36,9 @@ def load_hg_from_archive(
):
"""Import a mercurial tarball into swh.
Args: see :func:`HgArchiveBundle20Loader.load`.
Args: see :func:`HgArchiveLoaderFromDisk.load`.
"""
loader = HgArchiveBundle20Loader.from_configfile(
loader = HgArchiveLoaderFromDisk.from_configfile(
url=url, archive_path=archive_path, visit_date=parse_visit_date(visit_date)
)
return loader.load()
......@@ -7,7 +7,7 @@
def test_loader(
mocker, swh_config, swh_scheduler_celery_app, swh_scheduler_celery_worker
):
mock_loader = mocker.patch("swh.loader.mercurial.loader.HgBundle20Loader.load")
mock_loader = mocker.patch("swh.loader.mercurial.from_disk.HgLoaderFromDisk.load")
mock_loader.return_value = {"status": "eventful"}
res = swh_scheduler_celery_app.send_task(
......@@ -27,7 +27,7 @@ def test_archive_loader(
mocker, swh_config, swh_scheduler_celery_app, swh_scheduler_celery_worker
):
mock_loader = mocker.patch(
"swh.loader.mercurial.loader.HgArchiveBundle20Loader.load"
"swh.loader.mercurial.from_disk.HgArchiveLoaderFromDisk.load"
)
mock_loader.return_value = {"status": "uneventful"}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment