Skip to content

Commit

Permalink
VCS: remove code for old VCS support
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
humitos committed Jun 4, 2024
1 parent 276590c commit 140f2b0
Show file tree
Hide file tree
Showing 26 changed files with 43 additions and 706 deletions.
42 changes: 20 additions & 22 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,52 @@ Welcome to Read the Docs
Purpose
-------

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

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

Documentation for RTD
---------------------
Documentation for Read the Docs
-------------------------------

You will find complete documentation for setting up your project at `the Read
the Docs site`_.
You will find complete documentation for setting up your project at `the Read the Docs site`_.

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

Get in touch
------------

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>`_.
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>`_.

Contributing
------------

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

Quickstart for GitHub hosted projects
-------------------------------------

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

#. Create an account on `Read the Docs`_. You will get an email verifying your
email address which you should accept within 7 days.

#. Log in and click on "Import a Project".

#. Click "Connect to GitHub" in order to connect your account's repositories to GitHub.
#. Create an account on `Read the Docs`_ by signing up with GitHub.

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

#. Click "Import a Repository" and select any desired repository.
#. Log in and click on "Add project".

#. Start typing the name of your repository and select it from the list,
and click "Continue".

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

Expand Down
8 changes: 2 additions & 6 deletions docs/user/guides/setup/git-repo-manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,9 @@ For example, the cURL command to build the ``dev`` branch, using the token
curl -X POST -d "branches=dev" -d "token=1234" -d "default_branch=main"
https://readthedocs.org/api/v2/webhook/example-project/1/

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

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

Authentication
^^^^^^^^^^^^^^
Expand Down
6 changes: 2 additions & 4 deletions docs/user/intro/import-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ project, you will be asked for the repository URL, along with some other
information for your new project. The URL is normally the URL or path name you'd
use to checkout, clone, or branch your repository. Some examples:

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

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

Expand Down
17 changes: 2 additions & 15 deletions docs/user/versions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Versions
Read the Docs supports multiple versions of your repository.
On initial import,
we will create a ``latest`` version.
This will point at the default branch defined in your VCS control
(by default, ``main`` on Git and ``default`` in Mercurial).
This will point at the default branch defined in your Git repository.
(by default, ``main``).

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

Version Control Support Matrix
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+------------+------------+-----------+------------+-----------+
| | git | hg | bzr | svn |
+============+============+===========+============+===========+
| Tags | Yes | Yes | Yes | No |
+------------+------------+-----------+------------+-----------+
| Branches | Yes | Yes | Yes | No |
+------------+------------+-----------+------------+-----------+
| Default | master | default | | trunk |
+------------+------------+-----------+------------+-----------+

Version warning
---------------

Expand Down
4 changes: 2 additions & 2 deletions readthedocs/api/v3/tests/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def test_update_project(self):
"name": "Updated name",
"repository": {
"url": "https://bitbucket.com/rtfd/updated-repository",
"type": "hg",
"type": "git",
},
"language": "es",
"programming_language": "js",
Expand Down Expand Up @@ -429,7 +429,7 @@ def test_update_project(self):
self.assertEqual(
self.project.repo, "https://bitbucket.com/rtfd/updated-repository"
)
self.assertEqual(self.project.repo_type, "hg")
self.assertEqual(self.project.repo_type, "git")
self.assertEqual(self.project.language, "es")
self.assertEqual(self.project.programming_language, "js")
self.assertEqual(self.project.project_url, "https://updated-homepage.org")
Expand Down
3 changes: 1 addition & 2 deletions readthedocs/builds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ class Version(TimeStampedModel):
# used by the vcs backend

#: The identifier is the ID for the revision this is version is for.
#: This might be the revision number (e.g. in SVN),
#: or the commit hash (e.g. in Git).
#: This is the commit hash (e.g. in Git).
#: If the this version is pointing to a branch,
#: then ``identifier`` will contain the branch name.
#: `None`/`null` means it will use the VCS default branch.
Expand Down
3 changes: 1 addition & 2 deletions readthedocs/doc_builder/director.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ def checkout(self):
if "image" not in build_config_key and "os" not in build_config_key:
raise BuildUserError(BuildUserError.BUILD_OS_REQUIRED)

if self.vcs_repository.supports_submodules:
self.vcs_repository.update_submodules(self.data.config)
self.vcs_repository.update_submodules(self.data.config)

# System dependencies (``build.apt_packages``)
# NOTE: `system_dependencies` should not be possible to override by the
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/oauth/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class RemoteRepository(TimeStampedModel):
max_length=512,
blank=True,
validators=[
URLValidator(schemes=["http", "https", "ssh", "git", "svn"]),
URLValidator(schemes=["http", "https", "ssh", "git"]),
],
)
html_url = models.URLField(_("HTML URL"), null=True, blank=True)
Expand Down
10 changes: 1 addition & 9 deletions readthedocs/projects/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,8 @@
)

REPO_TYPE_GIT = "git"
REPO_TYPE_SVN = "svn"
REPO_TYPE_HG = "hg"
REPO_TYPE_BZR = "bzr"

REPO_CHOICES = (
(REPO_TYPE_GIT, _("Git")),
(REPO_TYPE_SVN, _("Subversion")),
(REPO_TYPE_HG, _("Mercurial")),
(REPO_TYPE_BZR, _("Bazaar")),
)
REPO_CHOICES = ((REPO_TYPE_GIT, _("Git")),)

PUBLIC = "public"
PRIVATE = "private"
Expand Down
7 changes: 1 addition & 6 deletions readthedocs/projects/tasks/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,7 @@ def execute(self):
verbose_name=self.data.version.verbose_name,
version_type=self.data.version.type,
)
if not vcs_repository.supports_lsremote:
log.info("Syncing repository via full clone.")
vcs_repository.update()
else:
log.info("Syncing repository via remote listing.")

log.info("Syncing repository via remote listing.")
self.sync_versions(vcs_repository)


Expand Down
26 changes: 5 additions & 21 deletions readthedocs/projects/tasks/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,12 @@ def sync_versions(self, vcs_repository):
# and just validate them trigger the task. All the other logic should
# be done by the BuildDirector or the VCS backend. We should not
# check this here and do not depend on ``vcs_repository``.
sync_tags = vcs_repository.supports_tags and not self.data.project.has_feature(
Feature.SKIP_SYNC_TAGS
sync_tags = not self.data.project.has_feature(Feature.SKIP_SYNC_TAGS)
sync_branches = not self.data.project.has_feature(Feature.SKIP_SYNC_BRANCHES)
branches, tags = vcs_repository.lsremote(
include_tags=sync_tags,
include_branches=sync_branches,
)
sync_branches = (
vcs_repository.supports_branches
and not self.data.project.has_feature(Feature.SKIP_SYNC_BRANCHES)
)
tags = []
branches = []
if vcs_repository.supports_lsremote:
branches, tags = vcs_repository.lsremote(
include_tags=sync_tags,
include_branches=sync_branches,
)

# Remove this block once we drop support for Bazaar, SVG and Mercurial.
# Since we will only support Git, lsremote will be always available.
else:
if sync_tags:
tags = vcs_repository.tags
if sync_branches:
branches = vcs_repository.branches

tags_data = [
{
Expand Down
77 changes: 1 addition & 76 deletions readthedocs/rtd_tests/tests/projects/test_version_sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@

from readthedocs.builds.constants import BRANCH, LATEST
from readthedocs.builds.models import Version
from readthedocs.projects.constants import (
REPO_TYPE_BZR,
REPO_TYPE_GIT,
REPO_TYPE_HG,
REPO_TYPE_SVN,
)
from readthedocs.projects.constants import REPO_TYPE_GIT
from readthedocs.projects.models import Project
from readthedocs.projects.templatetags.projects_tags import sort_version_aware

Expand Down Expand Up @@ -143,73 +138,3 @@ def test_sort_git_master_and_latest(self):
["master", "latest", "2.0", "1.10", "1.9", "1.1", "1.0"],
[v.slug for v in sort_version_aware(versions)],
)

def test_sort_hg_default(self):
identifiers = ["default", "1.0", "2.0", "1.1", "1.9", "1.10"]
self.project.repo_type = REPO_TYPE_HG
self.project.save()
self.project.versions.get(slug=LATEST).delete()

for identifier in identifiers:
get(
Version,
project=self.project,
type=BRANCH,
identifier=identifier,
verbose_name=identifier,
slug=identifier,
)

versions = list(Version.objects.filter(project=self.project))
self.assertEqual(
["default", "2.0", "1.10", "1.9", "1.1", "1.0"],
[v.slug for v in sort_version_aware(versions)],
)

def test_sort_bzr_latest(self):
"""
BZR doesn't have a name for "master",
so here master gets sorted by its ascii value.
"""
identifiers = ["master", "1.0", "2.0", "1.1", "1.9", "1.10"]
self.project.repo_type = REPO_TYPE_BZR
self.project.save()
self.project.versions.get(slug=LATEST).delete()

for identifier in identifiers:
get(
Version,
project=self.project,
type=BRANCH,
identifier=identifier,
verbose_name=identifier,
slug=identifier,
)

versions = list(Version.objects.filter(project=self.project))
self.assertEqual(
["2.0", "1.10", "1.9", "1.1", "1.0", "master"],
[v.slug for v in sort_version_aware(versions)],
)

def test_sort_svn_trunk(self):
identifiers = ["/trunk/", "1.0", "2.0", "1.1", "1.9", "1.10"]
self.project.repo_type = REPO_TYPE_SVN
self.project.save()
self.project.versions.get(slug=LATEST).delete()

for identifier in identifiers:
get(
Version,
project=self.project,
type=BRANCH,
identifier=identifier,
verbose_name=identifier,
slug=identifier,
)

versions = list(Version.objects.filter(project=self.project))
self.assertEqual(
["/trunk/", "2.0", "1.10", "1.9", "1.1", "1.0"],
[v.slug for v in sort_version_aware(versions)],
)
Loading

0 comments on commit 140f2b0

Please sign in to comment.