diff --git a/assets/src/bundles/save/index.js b/assets/src/bundles/save/index.js --- a/assets/src/bundles/save/index.js +++ b/assets/src/bundles/save/index.js @@ -358,7 +358,7 @@ } if (validUrl) { - const allowedProtocols = ['http:', 'https:', 'svn:', 'git:']; + const allowedProtocols = ['http:', 'https:', 'svn:', 'git:', 'rsync:', 'pserver:', 'ssh:']; validUrl = ( allowedProtocols.find(protocol => protocol === originUrl.protocol) !== undefined ); diff --git a/cypress/integration/origin-save.spec.js b/cypress/integration/origin-save.spec.js --- a/cypress/integration/origin-save.spec.js +++ b/cypress/integration/origin-save.spec.js @@ -19,8 +19,8 @@ 'csrfError': 'CSRF Failed: Referrer checking failed - no Referrer.' }; -const anonymousVisitTypes = ['git', 'hg', 'svn']; -const allVisitTypes = ['archives', 'git', 'hg', 'svn']; +const anonymousVisitTypes = ['cvs', 'git', 'hg', 'svn']; +const allVisitTypes = ['archives', 'cvs', 'git', 'hg', 'svn']; function makeOriginSaveRequest(originType, originUrl) { cy.get('#swh-input-origin-url') diff --git a/swh/web/common/origin_save.py b/swh/web/common/origin_save.py --- a/swh/web/common/origin_save.py +++ b/swh/web/common/origin_save.py @@ -121,7 +121,12 @@ # map visit type to scheduler task # TODO: do not hardcode the task name here (T1157) -_visit_type_task = {"git": "load-git", "hg": "load-hg", "svn": "load-svn"} +_visit_type_task = { + "git": "load-git", + "hg": "load-hg", + "svn": "load-svn", + "cvs": "load-cvs", +} _visit_type_task_privileged = { "archives": "load-archive-files", @@ -203,7 +208,9 @@ ) -_validate_url = URLValidator(schemes=["http", "https", "svn", "git"]) +_validate_url = URLValidator( + schemes=["http", "https", "svn", "git", "rsync", "pserver", "ssh"] +) def _check_origin_url_valid(origin_url: str) -> None: diff --git a/swh/web/templates/misc/origin-save.html b/swh/web/templates/misc/origin-save.html --- a/swh/web/templates/misc/origin-save.html +++ b/swh/web/templates/misc/origin-save.html @@ -85,6 +85,9 @@
  • git, for origins using Git
  • hg, for origins using Mercurial
  • svn, for origins using Subversion
  • + {% if "cvs" in visit_types %} +
  • cvs, for origins using CVS
  • + {% endif %}
  • Origin url: the url of the remote repository for the software origin.
    diff --git a/swh/web/tests/conftest.py b/swh/web/tests/conftest.py --- a/swh/web/tests/conftest.py +++ b/swh/web/tests/conftest.py @@ -446,7 +446,7 @@ swh_scheduler.create_task_type( { "type": "load-svn", - "description": "Update a mercurial repository", + "description": "Update a Subversion repository", "backend_name": "swh.loader.svn.tasks.DumpMountAndLoadSvnRepository", "default_interval": timedelta(days=64), "min_interval": timedelta(hours=12), @@ -457,6 +457,21 @@ "retry_delay": timedelta(hours=2), } ) + # create load-cvs task type + swh_scheduler.create_task_type( + { + "type": "load-cvs", + "description": "Update a CVS repository", + "backend_name": "swh.loader.cvs.tasks.DumpMountAndLoadSvnRepository", + "default_interval": timedelta(days=64), + "min_interval": timedelta(hours=12), + "max_interval": timedelta(days=64), + "backoff_factor": 2, + "max_queue_length": None, + "num_retries": 7, + "retry_delay": timedelta(hours=2), + } + ) # add method to add load-archive-files task type during tests def add_load_archive_task_type(): diff --git a/swh/web/tests/misc/test_origin_save.py b/swh/web/tests/misc/test_origin_save.py --- a/swh/web/tests/misc/test_origin_save.py +++ b/swh/web/tests/misc/test_origin_save.py @@ -14,7 +14,7 @@ from swh.web.common.utils import reverse from swh.web.tests.utils import check_http_get_response -VISIT_TYPES = ("git", "svn", "hg") +VISIT_TYPES = ("git", "svn", "hg", "cvs") PRIVILEGED_VISIT_TYPES = tuple(list(VISIT_TYPES) + ["archives"])