Skip to content

Commit a95c90c

Browse files
committed
Merge branch 'master' into dont-trigger-two-syncs
2 parents ac34fb9 + 9676bdd commit a95c90c

File tree

10 files changed

+72
-12
lines changed

10 files changed

+72
-12
lines changed

.travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
env: TOXENV=py36,codecov ES_VERSION=6.2.4 ES_DOWNLOAD_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz
1010
- python: 3.6
1111
env: TOXENV=docs
12+
- python: 3.6
13+
env: TOXENV=docs-linkcheck
1214
- python: 3.6
1315
env: TOXENV=docs-lint
1416
- python: 3.6
@@ -18,6 +20,9 @@ jobs:
1820
env: TOXENV=eslint NODE_VERSION=10.17.0
1921
- python: 3.6
2022
env: TOXENV=migrations
23+
24+
allow_failures:
25+
- env: TOXENV=docs-linkcheck
2126
cache:
2227
directories:
2328
- ~/.cache/pip

CHANGELOG.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ Version 3.2.2
918918
* `@pyup-bot <https://github.com/pyup-bot>`__: Pin pytest-cov to latest version 2.6.1 (`#5276 <https://github.com/readthedocs/readthedocs.org/pull/5276>`__)
919919
* `@pyup-bot <https://github.com/pyup-bot>`__: Pin pillow to latest version 5.4.1 (`#5275 <https://github.com/readthedocs/readthedocs.org/pull/5275>`__)
920920
* `@pyup-bot <https://github.com/pyup-bot>`__: Update elasticsearch to 6.3.1 (`#5274 <https://github.com/readthedocs/readthedocs.org/pull/5274>`__)
921-
* `@discdiver <https://github.com/discdiver>`__: clarify github integration needs https:// prepended (`#5273 <https://github.com/readthedocs/readthedocs.org/pull/5273>`__)
921+
* `@discdiver <https://github.com/discdiver>`__: clarify github integration needs ``https://`` prepended (`#5273 <https://github.com/readthedocs/readthedocs.org/pull/5273>`__)
922922
* `@humitos <https://github.com/humitos>`__: Setup and configure pyup.io (`#5272 <https://github.com/readthedocs/readthedocs.org/pull/5272>`__)
923923
* `@humitos <https://github.com/humitos>`__: Update all Python dependencies (`#5269 <https://github.com/readthedocs/readthedocs.org/pull/5269>`__)
924924
* `@davidfischer <https://github.com/davidfischer>`__: Add note about security issue (`#5263 <https://github.com/readthedocs/readthedocs.org/pull/5263>`__)

dockerfiles/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
3434

3535
RUN pip3 install --no-cache-dir --upgrade pip
3636

37+
# Ensure that ``python`` is in the PATH so that ``./manage.py`` works
38+
RUN ln -s /usr/bin/python3 /usr/bin/python
39+
3740
WORKDIR /tmp
3841

3942
RUN curl -O https://raw.githubusercontent.com/readthedocs/readthedocs.org/master/requirements/pip.txt

docs/conf.py

+12
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,18 @@ def get_version():
103103
<p>Try using the search box or go to the homepage.</p>
104104
''',
105105
}
106+
linkcheck_ignore = [
107+
r'http://127\.0\.0\.1',
108+
r'http://localhost',
109+
r'https://yourproject\.readthedocs\.io',
110+
r'https?://docs\.example\.com',
111+
r'https://foo\.readthedocs\.io/projects',
112+
r'https://github\.com.+?#L\d+',
113+
r'https://github\.com/readthedocs/readthedocs\.org/issues',
114+
r'https://github\.com/readthedocs/readthedocs\.org/pull',
115+
r'https://docs\.readthedocs\.io/\?rtd_search',
116+
r'https://readthedocs\.org/search',
117+
]
106118

107119

108120
def setup(app):

readthedocs/projects/admin.py

+16
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from django.contrib import admin, messages
44
from django.contrib.admin.actions import delete_selected
5+
from django.forms import BaseInlineFormSet
56
from django.utils.translation import ugettext_lazy as _
67

78
from readthedocs.builds.models import Version
@@ -53,12 +54,27 @@ class ProjectRelationshipInline(admin.TabularInline):
5354
raw_id_fields = ('child',)
5455

5556

57+
class VersionInlineFormSet(BaseInlineFormSet):
58+
59+
"""Limit the number of versions displayed in the inline."""
60+
61+
LIMIT = 200
62+
63+
def __init__(self, *args, **kwargs):
64+
super().__init__(*args, **kwargs)
65+
self.queryset = self.queryset[:self.LIMIT]
66+
67+
5668
class VersionInline(admin.TabularInline):
5769

5870
"""Version inline relationship view for :py:class:`ProjectAdmin`."""
5971

72+
formset = VersionInlineFormSet
6073
model = Version
6174

75+
def get_queryset(self, request):
76+
return super().get_queryset(request).select_related("project")
77+
6278

6379
class RedirectInline(admin.TabularInline):
6480

readthedocs/settings/base.py

+2
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ def USE_PROMOS(self): # noqa
312312
CELERYD_TASK_TIME_LIMIT = 60 * 60 # 60 minutes
313313
CELERY_SEND_TASK_ERROR_EMAILS = False
314314
CELERYD_HIJACK_ROOT_LOGGER = False
315+
# This stops us from pre-fetching a task that then sits around on the builder
316+
CELERY_ACKS_LATE = True
315317
# Don't queue a bunch of tasks in the workers
316318
CELERYD_PREFETCH_MULTIPLIER = 1
317319
CELERY_CREATE_MISSING_QUEUES = True

readthedocs/settings/docker_compose.py

+4
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,7 @@ def DATABASES(self): # noqa
123123
AZURE_EMULATED_MODE = True
124124
AZURE_CUSTOM_DOMAIN = 'storage:10000'
125125
AZURE_SSL = False
126+
127+
# Remove the checks on the number of fields being submitted
128+
# This limit is mostly hit on large forms in the Django admin
129+
DATA_UPLOAD_MAX_NUMBER_FIELDS = None

readthedocs/vcs_support/backends/git.py

+21-9
Original file line numberDiff line numberDiff line change
@@ -203,16 +203,28 @@ def clone(self):
203203
def tags(self):
204204
versions = []
205205
repo = git.Repo(self.working_dir)
206+
207+
# Build a cache of tag -> commit
208+
# GitPython is not very optimized for reading large numbers of tags
209+
ref_cache = {} # 'ref/tags/<tag>' -> hexsha
210+
for hexsha, ref in git.TagReference._iter_packed_refs(repo):
211+
ref_cache[ref] = hexsha
212+
206213
for tag in repo.tags:
207-
try:
208-
versions.append(VCSVersion(self, str(tag.commit), str(tag)))
209-
except ValueError:
210-
# ValueError: Cannot resolve commit as tag TAGNAME points to a
211-
# blob object - use the `.object` property instead to access it
212-
# This is not a real tag for us, so we skip it
213-
# https://github.com/rtfd/readthedocs.org/issues/4440
214-
log.warning('Git tag skipped: %s', tag, exc_info=True)
215-
continue
214+
if tag.path in ref_cache:
215+
hexsha = ref_cache[tag.path]
216+
else:
217+
try:
218+
hexsha = str(tag.commit)
219+
except ValueError:
220+
# ValueError: Cannot resolve commit as tag TAGNAME points to a
221+
# blob object - use the `.object` property instead to access it
222+
# This is not a real tag for us, so we skip it
223+
# https://github.com/rtfd/readthedocs.org/issues/4440
224+
log.warning('Git tag skipped: %s', tag, exc_info=True)
225+
continue
226+
227+
versions.append(VCSVersion(self, hexsha, str(tag)))
216228
return versions
217229

218230
@property

requirements/pip.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pip==19.3.1
33
appdirs==1.4.3
44
virtualenv==16.7.7
55

6-
django==1.11.27 # pyup: <1.12
6+
django==1.11.28 # pyup: <1.12
77
django-extensions==2.2.5
88
django_polymorphic==2.1.2
99

@@ -42,7 +42,7 @@ celery==4.1.1 # pyup: ignore
4242

4343
django-allauth==0.40.0
4444

45-
GitPython==3.0.4
45+
GitPython==3.0.8
4646

4747
# Search
4848
elasticsearch==6.4.0 # pyup: <7.0.0

tox.ini

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ changedir = {toxinidir}/docs
2727
commands =
2828
sphinx-build -W --keep-going -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
2929

30+
[testenv:docs-linkcheck]
31+
description = Check for broken links in the docs
32+
changedir = {toxinidir}/docs
33+
commands =
34+
sphinx-build -W --keep-going -q -b linkcheck -d {envtmpdir}/doctrees . {envtmpdir}/linkcheck
35+
3036
[testenv:migrations]
3137
description = check for missing migrations
3238
changedir = {toxinidir}

0 commit comments

Comments
 (0)