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 | ||||
anlambert: 2019 | |||||
# 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 current_app as app | from celery import current_app as app | ||||
from .loader import ( | from .loader import ( | ||||
SvnLoader, SvnLoaderFromDumpArchive, SvnLoaderFromRemoteDump | SvnLoader, SvnLoaderFromDumpArchive, SvnLoaderFromRemoteDump | ||||
Show All 17 Lines | Args: | ||||
- destination_path (str): (mandatory) root directory to | - destination_path (str): (mandatory) root directory to | ||||
locally retrieve svn's data | locally retrieve svn's data | ||||
- origin_url (str): Optional original url override | - origin_url (str): Optional original url override | ||||
- swh_revision (dict): (optional) extra revision hex to | - swh_revision (dict): (optional) extra revision hex to | ||||
start from. see swh.loader.svn.SvnLoader.process | start from. see swh.loader.svn.SvnLoader.process | ||||
docstring | docstring | ||||
""" | """ | ||||
return SvnLoader().load( | return SvnLoader(origin_url).load( | ||||
svn_url=svn_url, | svn_url=svn_url, | ||||
destination_path=destination_path, | destination_path=destination_path, | ||||
origin_url=origin_url, | |||||
swh_revision=swh_revision, | swh_revision=swh_revision, | ||||
visit_date=visit_date, | visit_date=visit_date, | ||||
start_from_scratch=start_from_scratch) | start_from_scratch=start_from_scratch) | ||||
@app.task(name=__name__ + '.MountAndLoadSvnRepository') | @app.task(name=__name__ + '.MountAndLoadSvnRepository') | ||||
def mount_load_svn(archive_path, origin_url=None, visit_date=None, | def mount_load_svn(archive_path, origin_url=None, visit_date=None, | ||||
start_from_scratch=False): | start_from_scratch=False): | ||||
"""1. Mount an svn dump from archive as a local svn repository | """1. Mount an svn dump from archive as a local svn repository | ||||
2. Load it through the svn loader | 2. Load it through the svn loader | ||||
3. Clean up mounted svn repository archive | 3. Clean up mounted svn repository archive | ||||
""" | """ | ||||
return SvnLoaderFromDumpArchive(archive_path).load( | return SvnLoaderFromDumpArchive(origin_url, archive_path).load( | ||||
svn_url=None, | svn_url=None, | ||||
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) | ||||
@app.task(name=__name__ + '.DumpMountAndLoadSvnRepository') | @app.task(name=__name__ + '.DumpMountAndLoadSvnRepository') | ||||
def dump_mount_load_svn(svn_url, origin_url=None, visit_date=None, | def dump_mount_load_svn(svn_url, origin_url=None, visit_date=None, | ||||
start_from_scratch=False): | start_from_scratch=False): | ||||
"""1. Mount an svn dump from archive as a local svn repository. | """1. Mount an svn dump from archive as a local svn repository. | ||||
2. Load it through the svn loader. | 2. Load it through the svn loader. | ||||
3. Clean up mounted svn repository archive. | 3. Clean up mounted svn repository archive. | ||||
""" | """ | ||||
return SvnLoaderFromRemoteDump().load( | return SvnLoaderFromRemoteDump(origin_url).load( | ||||
svn_url=svn_url, | svn_url=svn_url, | ||||
origin_url=origin_url, | |||||
visit_date=visit_date, | visit_date=visit_date, | ||||
start_from_scratch=start_from_scratch) | start_from_scratch=start_from_scratch) |
2019