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

Versions: allow latest to be a tag #10738

Merged
merged 5 commits into from
Sep 19, 2023
Merged

Versions: allow latest to be a tag #10738

merged 5 commits into from
Sep 19, 2023

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Sep 14, 2023

We were kind of always expecting latest (machine created) to be a branch (the field is even named default_branch!).

But we were allowing both branches and tags to be the default version (latest).

versions_choices = self.instance.versions(manager=INTERNAL).filter(
machine=False).values_list('verbose_name', flat=True)
self.fields['default_branch'].widget = forms.Select(
choices=[default_choice] + list(
zip(versions_choices, versions_choices)
),
)

The identifier of a tag is a commit, but users reference latest from the name of the tag, so I'm storing the name instead of the commit in that case. We could do the same for stable to solve #10715.

Closes #10735

We were kind of always expecting latest (machine created)
to be a branch (the field is even named `default_branch`!).

But we were allowing both branches and tags to be the default
version (latest).

https://github.com/readthedocs/readthedocs.org/blob/53e21bb3ee8a5fce0194eb5481fd81ac87d3d1fa/readthedocs/projects/forms.py#L272-L279

Closes #10735
@stsewd stsewd requested a review from a team as a code owner September 14, 2023 19:54
@stsewd stsewd requested a review from humitos September 14, 2023 19:54
Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

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

Overall it looks good. However, I'm not 100% sure to understand all the small details of this change. Mainly the query where we exclude the latest slug.

readthedocs/projects/models.py Outdated Show resolved Hide resolved
readthedocs/vcs_support/backends/git.py Show resolved Hide resolved
@stsewd stsewd merged commit 953d27a into main Sep 19, 2023
2 checks passed
@stsewd stsewd deleted the allow-latest-to-be-a-tag branch September 19, 2023 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to build latest version from a tag
2 participants