diff --git a/swh/loader/svn/tasks.py b/swh/loader/svn/tasks.py index b369d86..f65b801 100644 --- a/swh/loader/svn/tasks.py +++ b/swh/loader/svn/tasks.py @@ -1,77 +1,77 @@ # Copyright (C) 2015-2019 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 celery import shared_task from .loader import ( SvnLoader, SvnLoaderFromDumpArchive, SvnLoaderFromRemoteDump ) @shared_task(name=__name__ + '.LoadSvnRepository') -def load_svn(url=None, +def load_svn(*, url=None, origin_url=None, destination_path=None, swh_revision=None, visit_date=None, start_from_scratch=False): """Import a svn repository Args: args: ordered arguments (expected None) kwargs: Dictionary with the following expected keys: - url (str): (mandatory) svn's repository url - origin_url (str): Optional original url override - destination_path (str): (optional) root directory to locally retrieve svn's data - swh_revision (dict): (optional) extra revision hex to start from. see swh.loader.svn.SvnLoader.process docstring """ loader = SvnLoader(url, origin_url=origin_url, destination_path=destination_path, swh_revision=swh_revision, visit_date=visit_date, start_from_scratch=start_from_scratch) return loader.load() @shared_task(name=__name__ + '.MountAndLoadSvnRepository') -def load_svn_from_archive(url=None, +def load_svn_from_archive(*, url=None, archive_path=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 = SvnLoaderFromDumpArchive( url, archive_path=archive_path, visit_date=visit_date, start_from_scratch=start_from_scratch) return loader.load() @shared_task(name=__name__ + '.DumpMountAndLoadSvnRepository') -def load_svn_from_remote_dump(url=None, +def load_svn_from_remote_dump(*, url=None, origin_url=None, visit_date=None, start_from_scratch=False): """1. Mount a remote svn dump as a local svn repository. 2. Load it through the svn loader. 3. Clean up mounted svn repository archive. """ loader = SvnLoaderFromRemoteDump( url, origin_url=origin_url, visit_date=visit_date, start_from_scratch=start_from_scratch) return loader.load() diff --git a/swh/loader/svn/tests/test_task.py b/swh/loader/svn/tests/test_task.py index c2430f9..7579ef9 100644 --- a/swh/loader/svn/tests/test_task.py +++ b/swh/loader/svn/tests/test_task.py @@ -1,50 +1,50 @@ # Copyright (C) 2019 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 def test_svn_loader(mocker, swh_app, celery_session_worker, swh_config): mock_loader = mocker.patch('swh.loader.svn.loader.SvnLoader.load') mock_loader.return_value = {'status': 'eventful'} res = swh_app.send_task( 'swh.loader.svn.tasks.LoadSvnRepository', - (), dict(url='some-technical-url', origin_url='origin-url')) + kwargs=dict(url='some-technical-url', origin_url='origin-url')) assert res res.wait() assert res.successful() assert res.result == {'status': 'eventful'} def test_svn_loader_from_dump( mocker, swh_app, celery_session_worker, swh_config): mock_loader = mocker.patch( 'swh.loader.svn.loader.SvnLoaderFromDumpArchive.load') mock_loader.return_value = {'status': 'eventful'} res = swh_app.send_task( 'swh.loader.svn.tasks.MountAndLoadSvnRepository', - (), dict(url='some-url', archive_path='some-path')) + kwargs=dict(url='some-url', archive_path='some-path')) assert res res.wait() assert res.successful() assert res.result == {'status': 'eventful'} def test_svn_loader_from_remote_dump( mocker, swh_app, celery_session_worker, swh_config): mock_loader = mocker.patch( 'swh.loader.svn.loader.SvnLoaderFromRemoteDump.load') mock_loader.return_value = {'status': 'eventful'} res = swh_app.send_task( 'swh.loader.svn.tasks.DumpMountAndLoadSvnRepository', - (), dict(url='some-remote-dump-url', origin_url='origin-url')) + kwargs=dict(url='some-remote-dump-url', origin_url='origin-url')) assert res res.wait() assert res.successful() assert res.result == {'status': 'eventful'}