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 @@ -340,6 +340,8 @@ const val = $(this).val(); if (val && originUrl.includes(val)) { $(this).prop('selected', true); + // origin URL input need to be validated once new visit type set + validateSaveOriginUrl($('#swh-input-origin-url')[0]); } }); }); @@ -364,7 +366,7 @@ } if (validUrl) { - const allowedProtocols = ['http:', 'https:', 'svn:', 'git:', 'rsync:', 'pserver:', 'ssh:']; + const allowedProtocols = ['http:', 'https:', 'svn:', 'git:', 'rsync:', 'pserver:', 'ssh:', 'bzr:']; 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 = ['cvs', 'git', 'hg', 'svn']; -const allVisitTypes = ['archives', 'cvs', 'git', 'hg', 'svn']; +const anonymousVisitTypes = ['bzr', 'cvs', 'git', 'hg', 'svn']; +const allVisitTypes = ['archives', 'bzr', '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 @@ -120,8 +120,10 @@ "hg": "load-hg", "svn": "load-svn", "cvs": "load-cvs", + "bzr": "load-bzr", } + _visit_type_task_privileged = { "archives": "load-archive-files", } @@ -203,7 +205,7 @@ _validate_url = URLValidator( - schemes=["http", "https", "svn", "git", "rsync", "pserver", "ssh"] + schemes=["http", "https", "svn", "git", "rsync", "pserver", "ssh", "bzr"] ) 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 @@ -88,6 +88,9 @@ {% if "cvs" in visit_types %}
  • cvs, for origins using CVS
  • {% endif %} + {% if "bzr" in visit_types %} +
  • bzr, for origins using Bazaar
  • + {% 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 @@ -1142,6 +1142,21 @@ "retry_delay": timedelta(hours=2), } ) + # create load-bzr task type + swh_scheduler.create_task_type( + { + "type": "load-bzr", + "description": "Update a Bazaar repository", + "backend_name": "swh.loader.bzr.tasks.LoadBazaar", + "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", "cvs") +VISIT_TYPES = ("git", "svn", "hg", "cvs", "bzr") PRIVILEGED_VISIT_TYPES = tuple(list(VISIT_TYPES) + ["archives"])