Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/svn/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 .loader import SWHSvnLoader, SWHSvnLoaderFromDumpArchive | from .loader import ( | ||||
SWHSvnLoader, SWHSvnLoaderFromDumpArchive, SWHSvnLoaderFromRemoteDump | |||||
) | |||||
class LoadSWHSvnRepositoryTsk(Task): | class LoadSWHSvnRepositoryTsk(Task): | ||||
"""Import one svn repository to Software Heritage. | """Import one svn repository to Software Heritage. | ||||
""" | """ | ||||
task_queue = 'swh_loader_svn' | task_queue = 'swh_loader_svn' | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | def run_task(self, *, archive_path, origin_url=None, visit_date=None, | ||||
""" | """ | ||||
loader = SWHSvnLoaderFromDumpArchive(archive_path) | loader = SWHSvnLoaderFromDumpArchive(archive_path) | ||||
loader.log = self.log | loader.log = self.log | ||||
return loader.load(svn_url='file://%s' % loader.repo_path, | return loader.load(svn_url='file://%s' % loader.repo_path, | ||||
origin_url=origin_url, | origin_url=origin_url, | ||||
visit_date=visit_date, | visit_date=visit_date, | ||||
archive_path=archive_path, | archive_path=archive_path, | ||||
start_from_scratch=start_from_scratch) | start_from_scratch=start_from_scratch) | ||||
class DumpMountAndLoadSvnRepositoryTsk(Task): | |||||
task_queue = 'swh_loader_svn_dump_mount_and_load' | |||||
def run_task(self, *, svn_url, origin_url=None, visit_date=None, | |||||
start_from_scratch=False): | |||||
"""1. Mount an svn dump from archive as a local svn repository. | |||||
2. Load it through the svn loader. | |||||
3. Clean up mounted svn repository archive. | |||||
""" | |||||
loader = SWHSvnLoaderFromRemoteDump(svn_url) | |||||
loader.log = self.log | |||||
return loader.load(svn_url='file://%s' % loader.repo_path, | |||||
origin_url=origin_url, | |||||
visit_date=visit_date, | |||||
start_from_scratch=start_from_scratch) |