From 445bc29da2fbe058ed0156f358d8e56763982603 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Mon, 30 Sep 2024 19:52:13 +0200 Subject: [PATCH] Notifications: unsupported VCS (#11627) * Notifications: unsupported VCS Closes #11600 * Update readthedocs/projects/notifications.py Co-authored-by: Eric Holscher <25510+ericholscher@users.noreply.github.com> --------- Co-authored-by: Eric Holscher <25510+ericholscher@users.noreply.github.com> --- readthedocs/doc_builder/director.py | 7 +------ readthedocs/projects/exceptions.py | 1 + readthedocs/projects/notifications.py | 13 +++++++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/readthedocs/doc_builder/director.py b/readthedocs/doc_builder/director.py index efae6cb1a7c..8f49c4074cf 100644 --- a/readthedocs/doc_builder/director.py +++ b/readthedocs/doc_builder/director.py @@ -13,7 +13,6 @@ import structlog import yaml from django.conf import settings -from django.utils.translation import gettext_lazy as _ from readthedocs.builds.constants import EXTERNAL from readthedocs.config.config import CONFIG_FILENAME_REGEX @@ -78,11 +77,7 @@ def setup_vcs(self): os.makedirs(self.data.project.doc_path) if not self.data.project.vcs_class(): - raise RepositoryError( - _('Repository type "{repo_type}" unknown').format( - repo_type=self.data.project.repo_type, - ), - ) + raise RepositoryError(RepositoryError.UNSUPPORTED_VCS) before_vcs.send( sender=self.data.version, diff --git a/readthedocs/projects/exceptions.py b/readthedocs/projects/exceptions.py index 724129b195f..acfb6f39f9b 100644 --- a/readthedocs/projects/exceptions.py +++ b/readthedocs/projects/exceptions.py @@ -25,6 +25,7 @@ class RepositoryError(BuildUserError): DUPLICATED_RESERVED_VERSIONS = "project:repository:duplicated-reserved-versions" FAILED_TO_CHECKOUT = "project:repository:checkout-failed" GENERIC = "project:repository:generic-error" + UNSUPPORTED_VCS = "project:repository:unsupported-vcs" class SyncRepositoryLocked(BuildAppError): diff --git a/readthedocs/projects/notifications.py b/readthedocs/projects/notifications.py index 1257e9e72e9..5a70036e874 100644 --- a/readthedocs/projects/notifications.py +++ b/readthedocs/projects/notifications.py @@ -94,6 +94,19 @@ ), type=ERROR, ), + Message( + id=RepositoryError.UNSUPPORTED_VCS, + header=_("Repository type not suported"), + body=_( + textwrap.dedent( + """ + Subversion, Mercurial, and Bazaar are not supported anymore. + Read more about this deprecation in our blog. + """ + ).strip(), + ), + type=ERROR, + ), Message( id=ProjectConfigurationError.NOT_FOUND, header=_("Sphinx configuration file is missing"),