Skip to content

Commit 770867f

Browse files
VCS: deprecation dates at application level (#11147)
* VCS: deprecation dates at application level Follow the dates published in our blog: https://about.readthedocs.com/blog/2024/02/drop-support-for-subversion-mercurial-bazaar/ Closes #8840 * Minor updates after doing more QA locally * Update readthedocs/notifications/messages.py Co-authored-by: Eric Holscher <[email protected]> * Typo --------- Co-authored-by: Eric Holscher <[email protected]>
1 parent 98e33f4 commit 770867f

File tree

6 files changed

+63
-6
lines changed

6 files changed

+63
-6
lines changed

readthedocs/doc_builder/exceptions.py

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class BuildUserError(BuildBaseException):
5050
BUILD_COMMANDS_IN_BETA = "build:user:build-commands-config-key-in-beta"
5151
BUILD_TIME_OUT = "build:user:time-out"
5252
BUILD_EXCESSIVE_MEMORY = "build:user:excessive-memory"
53+
VCS_DEPRECATED = "build:vcs:deprecated"
5354

5455

5556
class BuildMaxConcurrencyError(BuildUserError):

readthedocs/notifications/messages.py

+13
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,19 @@ def get_rendered_body(self):
188188
),
189189
type=ERROR,
190190
),
191+
Message(
192+
id=BuildUserError.VCS_DEPRECATED,
193+
header=_("Build used a deprecated VCS is not supported: {{vcs}}."),
194+
body=_(
195+
textwrap.dedent(
196+
"""
197+
{{vcs}} VCS is not supported anymore.
198+
Read more about this in our blog post <a href="https://about.readthedocs.com/blog/2024/02/drop-support-for-subversion-mercurial-bazaar/">Dropping support for Subversion, Mercurial, and Bazaar</a>.
199+
"""
200+
).strip(),
201+
),
202+
type=ERROR,
203+
),
191204
Message(
192205
id=BuildAppError.BUILD_DOCKER_UNKNOWN_ERROR,
193206
header=_("Build terminated due to unknown error."),

readthedocs/vcs_support/backends/bzr.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
import csv
44
import re
55
from io import StringIO
6+
67
from django.conf import settings
78

89
from readthedocs.projects.exceptions import RepositoryError
9-
from readthedocs.vcs_support.base import BaseVCS, VCSVersion
10+
from readthedocs.vcs_support.base import BaseVCS, Deprecated, VCSVersion
1011

1112

12-
class Backend(BaseVCS):
13+
class Backend(Deprecated, BaseVCS):
1314

1415
"""Bazaar VCS backend."""
1516

readthedocs/vcs_support/backends/hg.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
from django.conf import settings
33

44
from readthedocs.projects.exceptions import RepositoryError
5-
from readthedocs.vcs_support.base import BaseVCS, VCSVersion
5+
from readthedocs.vcs_support.base import BaseVCS, Deprecated, VCSVersion
66

77

8-
class Backend(BaseVCS):
8+
class Backend(Deprecated, BaseVCS):
99

1010
"""Mercurial VCS backend."""
1111

readthedocs/vcs_support/backends/svn.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
from django.conf import settings
77

88
from readthedocs.projects.exceptions import RepositoryError
9-
from readthedocs.vcs_support.base import BaseVCS, VCSVersion
9+
from readthedocs.vcs_support.base import BaseVCS, Deprecated, VCSVersion
1010

1111

12-
class Backend(BaseVCS):
12+
class Backend(Deprecated, BaseVCS):
1313

1414
"""Subversion VCS backend."""
1515

readthedocs/vcs_support/base.py

+42
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""Base classes for VCS backends."""
2+
import datetime
23
import os
34

5+
import pytz
46
import structlog
57

68
from readthedocs.core.utils.filesystem import safe_rmtree
@@ -33,6 +35,46 @@ def __repr__(self):
3335
)
3436

3537

38+
class Deprecated:
39+
def __init__(self, *args, **kwargs):
40+
tzinfo = pytz.timezone("America/Los_Angeles")
41+
now = datetime.datetime.now(tz=tzinfo)
42+
43+
# Brownout dates as published in https://about.readthedocs.com/blog/2024/02/drop-support-for-subversion-mercurial-bazaar/
44+
# fmt: off
45+
disabled = any([
46+
# 12 hours browndate
47+
datetime.datetime(2024, 4, 1, 0, 0, 0, tzinfo=tzinfo) < now < datetime.datetime(2024, 4, 1, 12, 0, 0, tzinfo=tzinfo),
48+
# 24 hours browndate
49+
datetime.datetime(2024, 5, 6, 0, 0, 0, tzinfo=tzinfo) < now < datetime.datetime(2024, 5, 7, 0, 0, 0, tzinfo=tzinfo),
50+
# 48 hours browndate
51+
datetime.datetime(2024, 5, 20, 0, 0, 0, tzinfo=tzinfo) < now < datetime.datetime(2024, 5, 22, 0, 0, 0, tzinfo=tzinfo),
52+
# Deprecated after June 3
53+
datetime.datetime(2024, 6, 3, 0, 0, 0, tzinfo=tzinfo) < now,
54+
])
55+
# fmt: on
56+
57+
if disabled:
58+
from .backends import bzr, hg, svn
59+
60+
vcs = None
61+
if isinstance(self, bzr.Backend):
62+
vcs = "Bazaar"
63+
elif isinstance(self, svn.Backend):
64+
vcs = "Subversion"
65+
elif isinstance(self, hg.Backend):
66+
vcs = "Mercurial"
67+
68+
raise BuildUserError(
69+
message_id=BuildUserError.VCS_DEPRECATED,
70+
format_values={
71+
"vcs": vcs,
72+
},
73+
)
74+
75+
super().__init__(*args, **kwargs)
76+
77+
3678
class BaseVCS:
3779

3880
"""

0 commit comments

Comments
 (0)