Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VCS: remove code for old VCS support #11377

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably just link to the tutorial :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to follow you here. Do you mean removing the Contributing section completely and replace it by another one talking about the Read the Docs tutorial?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The quickstart section.

-------------------------------------

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 |
+------------+------------+-----------+------------+-----------+
humitos marked this conversation as resolved.
Show resolved Hide resolved

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
36 changes: 36 additions & 0 deletions readthedocs/oauth/migrations/0016_deprecate_old_vcs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated by Django 4.2.13 on 2024-06-10 10:29

import django.core.validators
from django.db import migrations, models
from django_safemigrate import Safe


class Migration(migrations.Migration):
safe = Safe.before_deploy
dependencies = [
("oauth", "0015_increase_avatar_url_length"),
]

operations = [
migrations.AlterField(
model_name="remoterepository",
name="clone_url",
field=models.URLField(
blank=True,
max_length=512,
validators=[
django.core.validators.URLValidator(
schemes=["http", "https", "ssh", "git"]
)
],
verbose_name="Repository clone URL",
),
),
migrations.AlterField(
model_name="remoterepository",
name="vcs",
field=models.CharField(
blank=True, choices=[("git", "Git")], max_length=200, verbose_name="vcs"
),
),
]
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
11 changes: 2 additions & 9 deletions readthedocs/projects/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,9 @@
)

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")),
)
# TODO: Remove this since we only have 1 type.
REPO_CHOICES = ((REPO_TYPE_GIT, _("Git")),)
humitos marked this conversation as resolved.
Show resolved Hide resolved

PUBLIC = "public"
PRIVATE = "private"
Expand Down
34 changes: 34 additions & 0 deletions readthedocs/projects/migrations/0123_deprecate_old_vcs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 4.2.13 on 2024-06-10 10:29

from django.db import migrations, models
from django_safemigrate import Safe


class Migration(migrations.Migration):
safe = Safe.before_deploy
dependencies = [
("projects", "0122_add_httpheader_option"),
]

operations = [
migrations.AlterField(
model_name="historicalproject",
name="repo_type",
field=models.CharField(
choices=[("git", "Git")],
default="git",
max_length=10,
verbose_name="Repository type",
),
),
migrations.AlterField(
model_name="project",
name="repo_type",
field=models.CharField(
choices=[("git", "Git")],
default="git",
max_length=10,
verbose_name="Repository type",
),
),
]
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
Loading