Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/tar/tasks.py
# Copyright (C) 2015-2018 The Software Heritage developers | # Copyright (C) 2015-2018 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 swh.scheduler.task import Task | from swh.scheduler.task import Task | ||||
from swh.loader.tar.loader import TarLoader | from swh.loader.tar.loader import RemoteTarLoader | ||||
class LoadTarRepository(Task): | class LoadTarRepository(Task): | ||||
"""Import a directory to Software Heritage | """Import a remote or local archive to Software Heritage | ||||
""" | """ | ||||
task_queue = 'swh_loader_tar' | task_queue = 'swh_loader_tar' | ||||
def run_task(self, *, tar_path, origin, visit_date, revision, | def run_task(self, *, origin, visit_date, last_modified): | ||||
branch_name=None): | |||||
"""Import a tarball into swh. | """Import a tarball into swh. | ||||
Args: see :func:`TarLoader.load`. | Args: see :func:`TarLoader.prepare`. | ||||
""" | """ | ||||
loader = TarLoader() | loader = RemoteTarLoader() | ||||
loader.log = self.log | loader.log = self.log | ||||
return loader.load(tar_path=tar_path, origin=origin, | return loader.load( | ||||
visit_date=visit_date, revision=revision, | origin=origin, visit_date=visit_date, last_modified=last_modified) | ||||
branch_name=branch_name) |