Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/mercurial/tasks.py
# Copyright (C) 2017-2019 The Software Heritage developers | # Copyright (C) 2017-2019 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from celery import shared_task | from celery import shared_task | ||||
from .loader import HgArchiveBundle20Loader, HgBundle20Loader | from .loader import HgArchiveLoader, HgLoader | ||||
@shared_task(name=__name__ + ".LoadMercurial") | @shared_task(name=__name__ + ".LoadMercurial") | ||||
def load_hg(*, url, directory=None, visit_date=None): | def load_hg(*, url, directory=None, visit_date=None): | ||||
"""Mercurial repository loading | """Mercurial repository loading | ||||
Import a mercurial tarball into swh. | Import a mercurial tarball into swh. | ||||
Args: see :func:`DepositLoader.load`. | Args: see :func:`DepositLoader.load`. | ||||
""" | """ | ||||
loader = HgBundle20Loader(url, directory=directory, visit_date=visit_date) | loader = HgLoader(url, directory=directory, visit_date=visit_date) | ||||
return loader.load() | return loader.load() | ||||
@shared_task(name=__name__ + ".LoadArchiveMercurial") | @shared_task(name=__name__ + ".LoadArchiveMercurial") | ||||
def load_hg_from_archive(*, url, archive_path=None, visit_date=None): | def load_hg_from_archive(*, url, archive_path=None, visit_date=None): | ||||
"""Import a mercurial tarball into swh. | """Import a mercurial tarball into swh. | ||||
Args: see :func:`DepositLoader.load`. | Args: see :func:`DepositLoader.load`. | ||||
""" | """ | ||||
loader = HgArchiveBundle20Loader( | loader = HgArchiveLoader(url, archive_path=archive_path, visit_date=visit_date) | ||||
url, archive_path=archive_path, visit_date=visit_date | |||||
) | |||||
return loader.load() | return loader.load() |