Skip to content

Commit b2ab794

Browse files
VCS: remove code for old VCS support (#11377)
* VCS: remove code for old VCS support This PR removes the code for old VCS support. Besides, it touches the documentation slightly to remove mentions to particular VCS (Mercurial, Bazaar, SVN). However, it doesn't re-write all parts of the documentation where we are using "VCS" in a generic way. There should be another PR that re-phrase those senteces to mention Git directly. Related: * #11147 * #8840 * https://about.readthedocs.com/blog/2024/02/drop-support-for-subversion-mercurial-bazaar/ * Add migrations * Update readthedocs/projects/constants.py Co-authored-by: Eric Holscher <[email protected]> --------- Co-authored-by: Eric Holscher <[email protected]>
1 parent 372de4e commit b2ab794

28 files changed

+114
-706
lines changed

README.rst

+20-22
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,52 @@ Welcome to Read the Docs
66
Purpose
77
-------
88

9-
`Read the Docs`_ hosts documentation for the open source community. It supports
10-
Sphinx_ docs written with reStructuredText_, and can pull from your Subversion_,
11-
Bazaar_, Git_, and Mercurial_ repositories.
9+
`Read the Docs`_ hosts documentation for the open source community.
10+
It supports many documentation tools
11+
(e.g. Sphinx_ docs written with reStructuredText_, MkDocs_ docs written with markdown_, among others),
12+
and can pull Git_ repositories.
1213
Then we build documentation and host it for you.
13-
Think of it as *Continuous Documentation*.
14+
Think of it as *Continuous Documentation*, or Docs as Code.
1415

1516
.. _Read the docs: https://readthedocs.org/
1617
.. _Sphinx: http://www.sphinx-doc.org/
1718
.. _reStructuredText: http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
18-
.. _Subversion: http://subversion.tigris.org/
19-
.. _Bazaar: http://bazaar.canonical.com/
2019
.. _Git: http://git-scm.com/
21-
.. _Mercurial: https://www.mercurial-scm.org/
20+
.. _MkDocs: https://www.mkdocs.org/
21+
.. _markdown: https://daringfireball.net/projects/markdown/
2222

23-
Documentation for RTD
24-
---------------------
23+
Documentation for Read the Docs
24+
-------------------------------
2525

26-
You will find complete documentation for setting up your project at `the Read
27-
the Docs site`_.
26+
You will find complete documentation for setting up your project at `the Read the Docs site`_.
2827

2928
.. _the Read the Docs site: https://docs.readthedocs.io/
3029

3130
Get in touch
3231
------------
3332

34-
You can find information about getting in touch with Read the Docs at our `Contribution page <https://docs.readthedocs.io/en/latest/contribute.html#get-in-touch>`_.
33+
You can find information about getting in touch with Read the Docs at our
34+
`Contribution page <https://docs.readthedocs.io/en/latest/contribute.html#get-in-touch>`_.
3535

3636
Contributing
3737
------------
3838

39-
You can find information about contributing to Read the Docs at our `Contribution page <https://docs.readthedocs.io/en/latest/contribute.html>`_.
39+
You can find information about contributing to Read the Docs at our
40+
`Contribution page <https://docs.readthedocs.io/en/latest/contribute.html>`_.
4041

4142
Quickstart for GitHub hosted projects
4243
-------------------------------------
4344

44-
By the end of this quickstart, you will have a new project automatically updated
45-
when you push to GitHub.
45+
By the end of this quickstart, you will have a new project automatically updated when you push to GitHub.
4646

47-
#. Create an account on `Read the Docs`_. You will get an email verifying your
48-
email address which you should accept within 7 days.
49-
50-
#. Log in and click on "Import a Project".
51-
52-
#. Click "Connect to GitHub" in order to connect your account's repositories to GitHub.
47+
#. Create an account on `Read the Docs`_ by signing up with GitHub.
5348

5449
#. When prompted on GitHub, give access to your account.
5550

56-
#. Click "Import a Repository" and select any desired repository.
51+
#. Log in and click on "Add project".
52+
53+
#. Start typing the name of your repository and select it from the list,
54+
and click "Continue".
5755

5856
#. Change any information if desired and click "Next".
5957

docs/user/guides/setup/git-repo-manual.rst

+2-6
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,9 @@ For example, the cURL command to build the ``dev`` branch, using the token
186186
curl -X POST -d "branches=dev" -d "token=1234" -d "default_branch=main"
187187
https://readthedocs.org/api/v2/webhook/example-project/1/
188188

189-
A command like the one above could be called from a cron job or from a hook
190-
inside Git_, Subversion_, Mercurial_, or Bazaar_.
189+
A command like the one above could be called from a cron job or from a `Git hook`_.
191190

192-
.. _Git: http://www.kernel.org/pub/software/scm/git/docs/githooks.html
193-
.. _Subversion: https://www.mikewest.org/2006/06/subversion-post-commit-hooks-101
194-
.. _Mercurial: http://hgbook.red-bean.com/read/handling-repository-events-with-hooks.html
195-
.. _Bazaar: http://wiki.bazaar.canonical.com/BzrHooks
191+
.. _Git hook: http://www.kernel.org/pub/software/scm/git/docs/githooks.html
196192

197193
Authentication
198194
^^^^^^^^^^^^^^

docs/user/intro/import-guide.rst

+2-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ project, you will be asked for the repository URL, along with some other
4141
information for your new project. The URL is normally the URL or path name you'd
4242
use to checkout, clone, or branch your repository. Some examples:
4343

44-
* Git: ``https://github.com/ericholscher/django-kong.git``
45-
* Mercurial: ``https://bitbucket.org/ianb/pip``
46-
* Subversion: ``http://varnish-cache.org/svn/trunk``
47-
* Bazaar: ``lp:pasta``
44+
* ``https://github.com/ericholscher/django-kong.git``
45+
* ``https://gitlab.com/gitlab-org/gitlab``
4846

4947
Add an optional homepage URL and some tags, and then click **Next**.
5048

docs/user/versions.rst

+2-15
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Versions
44
Read the Docs supports multiple versions of your repository.
55
On initial import,
66
we will create a ``latest`` version.
7-
This will point at the default branch defined in your VCS control
8-
(by default, ``main`` on Git and ``default`` in Mercurial).
7+
This will point at the default branch defined in your Git repository.
8+
(by default, ``main``).
99

1010
If your project has any tags or branches with a name following `semantic versioning <https://semver.org/>`_,
1111
we also create a ``stable`` version, tracking your most recent release.
@@ -133,19 +133,6 @@ Read the Docs supports two workflows for versioning: based on tags or branches.
133133
If you have at least one tag,
134134
tags will take preference over branches when selecting the stable version.
135135

136-
Version Control Support Matrix
137-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
138-
139-
+------------+------------+-----------+------------+-----------+
140-
| | git | hg | bzr | svn |
141-
+============+============+===========+============+===========+
142-
| Tags | Yes | Yes | Yes | No |
143-
+------------+------------+-----------+------------+-----------+
144-
| Branches | Yes | Yes | Yes | No |
145-
+------------+------------+-----------+------------+-----------+
146-
| Default | master | default | | trunk |
147-
+------------+------------+-----------+------------+-----------+
148-
149136
Version warning
150137
---------------
151138

readthedocs/api/v3/tests/test_projects.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def test_update_project(self):
395395
"name": "Updated name",
396396
"repository": {
397397
"url": "https://bitbucket.com/rtfd/updated-repository",
398-
"type": "hg",
398+
"type": "git",
399399
},
400400
"language": "es",
401401
"programming_language": "js",
@@ -429,7 +429,7 @@ def test_update_project(self):
429429
self.assertEqual(
430430
self.project.repo, "https://bitbucket.com/rtfd/updated-repository"
431431
)
432-
self.assertEqual(self.project.repo_type, "hg")
432+
self.assertEqual(self.project.repo_type, "git")
433433
self.assertEqual(self.project.language, "es")
434434
self.assertEqual(self.project.programming_language, "js")
435435
self.assertEqual(self.project.project_url, "https://updated-homepage.org")

readthedocs/builds/models.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ class Version(TimeStampedModel):
105105
# used by the vcs backend
106106

107107
#: The identifier is the ID for the revision this is version is for.
108-
#: This might be the revision number (e.g. in SVN),
109-
#: or the commit hash (e.g. in Git).
108+
#: This is the commit hash (e.g. in Git).
110109
#: If the this version is pointing to a branch,
111110
#: then ``identifier`` will contain the branch name.
112111
#: `None`/`null` means it will use the VCS default branch.

readthedocs/doc_builder/director.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,7 @@ def checkout(self):
266266
if "image" not in build_config_key and "os" not in build_config_key:
267267
raise BuildUserError(BuildUserError.BUILD_OS_REQUIRED)
268268

269-
if self.vcs_repository.supports_submodules:
270-
self.vcs_repository.update_submodules(self.data.config)
269+
self.vcs_repository.update_submodules(self.data.config)
271270

272271
# System dependencies (``build.apt_packages``)
273272
# NOTE: `system_dependencies` should not be possible to override by the
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Generated by Django 4.2.13 on 2024-06-10 10:29
2+
3+
import django.core.validators
4+
from django.db import migrations, models
5+
from django_safemigrate import Safe
6+
7+
8+
class Migration(migrations.Migration):
9+
safe = Safe.before_deploy
10+
dependencies = [
11+
("oauth", "0015_increase_avatar_url_length"),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name="remoterepository",
17+
name="clone_url",
18+
field=models.URLField(
19+
blank=True,
20+
max_length=512,
21+
validators=[
22+
django.core.validators.URLValidator(
23+
schemes=["http", "https", "ssh", "git"]
24+
)
25+
],
26+
verbose_name="Repository clone URL",
27+
),
28+
),
29+
migrations.AlterField(
30+
model_name="remoterepository",
31+
name="vcs",
32+
field=models.CharField(
33+
blank=True, choices=[("git", "Git")], max_length=200, verbose_name="vcs"
34+
),
35+
),
36+
]

readthedocs/oauth/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class RemoteRepository(TimeStampedModel):
150150
max_length=512,
151151
blank=True,
152152
validators=[
153-
URLValidator(schemes=["http", "https", "ssh", "git", "svn"]),
153+
URLValidator(schemes=["http", "https", "ssh", "git"]),
154154
],
155155
)
156156
html_url = models.URLField(_("HTML URL"), null=True, blank=True)

readthedocs/projects/constants.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,9 @@
8181
)
8282

8383
REPO_TYPE_GIT = "git"
84-
REPO_TYPE_SVN = "svn"
85-
REPO_TYPE_HG = "hg"
86-
REPO_TYPE_BZR = "bzr"
8784

88-
REPO_CHOICES = (
89-
(REPO_TYPE_GIT, _("Git")),
90-
(REPO_TYPE_SVN, _("Subversion")),
91-
(REPO_TYPE_HG, _("Mercurial")),
92-
(REPO_TYPE_BZR, _("Bazaar")),
93-
)
85+
# TODO: Remove this since we only have 1 type.
86+
REPO_CHOICES = ((REPO_TYPE_GIT, _("Git")),)
9487

9588
PUBLIC = "public"
9689
PRIVATE = "private"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Generated by Django 4.2.13 on 2024-06-10 10:29
2+
3+
from django.db import migrations, models
4+
from django_safemigrate import Safe
5+
6+
7+
class Migration(migrations.Migration):
8+
safe = Safe.before_deploy
9+
dependencies = [
10+
("projects", "0122_add_httpheader_option"),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name="historicalproject",
16+
name="repo_type",
17+
field=models.CharField(
18+
choices=[("git", "Git")],
19+
default="git",
20+
max_length=10,
21+
verbose_name="Repository type",
22+
),
23+
),
24+
migrations.AlterField(
25+
model_name="project",
26+
name="repo_type",
27+
field=models.CharField(
28+
choices=[("git", "Git")],
29+
default="git",
30+
max_length=10,
31+
verbose_name="Repository type",
32+
),
33+
),
34+
]

readthedocs/projects/tasks/builds.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,7 @@ def execute(self):
233233
verbose_name=self.data.version.verbose_name,
234234
version_type=self.data.version.type,
235235
)
236-
if not vcs_repository.supports_lsremote:
237-
log.info("Syncing repository via full clone.")
238-
vcs_repository.update()
239-
else:
240-
log.info("Syncing repository via remote listing.")
241-
236+
log.info("Syncing repository via remote listing.")
242237
self.sync_versions(vcs_repository)
243238

244239

readthedocs/projects/tasks/mixins.py

+5-21
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,12 @@ def sync_versions(self, vcs_repository):
4141
# and just validate them trigger the task. All the other logic should
4242
# be done by the BuildDirector or the VCS backend. We should not
4343
# check this here and do not depend on ``vcs_repository``.
44-
sync_tags = vcs_repository.supports_tags and not self.data.project.has_feature(
45-
Feature.SKIP_SYNC_TAGS
44+
sync_tags = not self.data.project.has_feature(Feature.SKIP_SYNC_TAGS)
45+
sync_branches = not self.data.project.has_feature(Feature.SKIP_SYNC_BRANCHES)
46+
branches, tags = vcs_repository.lsremote(
47+
include_tags=sync_tags,
48+
include_branches=sync_branches,
4649
)
47-
sync_branches = (
48-
vcs_repository.supports_branches
49-
and not self.data.project.has_feature(Feature.SKIP_SYNC_BRANCHES)
50-
)
51-
tags = []
52-
branches = []
53-
if vcs_repository.supports_lsremote:
54-
branches, tags = vcs_repository.lsremote(
55-
include_tags=sync_tags,
56-
include_branches=sync_branches,
57-
)
58-
59-
# Remove this block once we drop support for Bazaar, SVG and Mercurial.
60-
# Since we will only support Git, lsremote will be always available.
61-
else:
62-
if sync_tags:
63-
tags = vcs_repository.tags
64-
if sync_branches:
65-
branches = vcs_repository.branches
6650

6751
tags_data = [
6852
{

0 commit comments

Comments
 (0)