Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Handle changing the branch of the 'latest' version

  • Loading branch information...
commit b32401b4b1525eab3f0ff24642788c18449c6e69 1 parent 36b1efc
@ericholscher ericholscher authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 readthedocs/projects/tasks.py
View
12 readthedocs/projects/tasks.py
@@ -44,10 +44,18 @@ def update_docs(pk, record=True, pdf=True, version_pk=None, touch=False):
versions = [Version.objects.get(pk=version_pk)]
else:
branch = project.default_branch or project.vcs_repo().fallback_branch
- versions = [Version.objects.get_or_create(project=project,
+ latest = Version.objects.filter(project=project, slug='latest')
+ if len(latest):
+ #Handle changing of latest's branch
+ if not latest.identifier == branch:
+ latest.identifier = branch
+ latest.save()
+ versions = [latest]
+ else:
+ versions = [Version.objects.create(project=project,
identifier=branch,
slug='latest',
- verbose_name='latest')[0]]# + list(project.versions.filter(active=True, uploaded=False))
+ verbose_name='latest')]
for version in versions:
#Make Dirs
Please sign in to comment.
Something went wrong with that request. Please try again.