diff --git a/debian/control b/debian/control index 9f26f4a..dca16c5 100644 --- a/debian/control +++ b/debian/control @@ -1,30 +1,32 @@ Source: swh-loader-mercurial Maintainer: Software Heritage developers Section: python Priority: optional Build-Depends: debhelper (>= 9), dh-python (>= 2), python3-all, python3-nose, python3-setuptools, python3-vcversioner, python3-retrying, python3-hglib, patool, python3-swh.core (>= 0.0.36~), python3-swh.storage (>= 0.0.95~), + python3-swh.scheduler (>= 0.0.19~), python-sqlitedict Standards-Version: 3.9.6 Homepage: https://forge.softwareheritage.org/source/swh-loader-mercurial/ Package: python3-swh.loader.mercurial Architecture: all Depends: python3-swh.core (>= 0.0.36~), python3-swh.storage (>= 0.0.95~), + python3-swh.scheduler (>= 0.0.19~), patool, python-sqlitedict, python3-hglib, ${misc:Depends}, ${python3:Depends} Description: Software Heritage Mercurial Loader Module in charge of loading hg/mercurial repositories into swh storage. diff --git a/requirements-swh.txt b/requirements-swh.txt index 14bd1b1..fcbecde 100644 --- a/requirements-swh.txt +++ b/requirements-swh.txt @@ -1,2 +1,3 @@ swh.core >= 0.0.36 swh.storage >= 0.0.95 +swh.scheduler >= 0.0.19 diff --git a/swh/loader/mercurial/tasks.py b/swh/loader/mercurial/tasks.py new file mode 100644 index 0000000..09403c8 --- /dev/null +++ b/swh/loader/mercurial/tasks.py @@ -0,0 +1,27 @@ +# Copyright (C) 2017 The Software Heritage developers +# See the AUTHORS file at the top-level directory of this distribution +# License: GNU General Public License version 3, or any later version +# See top-level LICENSE file for more information + +from swh.scheduler.task import Task + +from .bundle20_loader import HgBundle20Loader + + +class LoadMercurialTsk(Task): + """Mercurial repository loading + + """ + task_queue = 'swh_loader_mercurial' + + def run_task(self, *, origin_url, directory, fetch_date): + """Import a mercurial tarball into swh. + + Args: see :func:`DepositLoader.load`. + + """ + loader = HgBundle20Loader() + loader.log = self.log + loader.load(origin_url=origin_url, + directory=directory, + fetch_date=fetch_date)