Skip to content

Commit 30ad791

Browse files
committed
Sync versions: filter by type on update
If two versions share the same verbose name (a branch named 2.0 and a tag named 2.0), then we will be updating both, instead of just one and changing its type from branch to tag. Later when running this same code, it will see the branch as new, since isn't included in our queryset that filters by type=branch. This wasn't happening before because this check was true https://github.com/readthedocs/readthedocs.org/blob/2e3f208c4906de649a9b5b9e33afee6cc20b86bc/readthedocs/api/v2/utils.py#L74-L74 Since a branch would never change its identifier (origin/name), but once lsremote was enabled, the identifier didn't included the 'origin/' part. So, when doing a full build the branches would be changed to (origin/name) and when doing a syn they would be changed to (name), and so on. Ref #8992 (comment)
1 parent 2e3f208 commit 30ad791

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

readthedocs/api/v2/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ def sync_versions_to_db(project, versions, type): # pylint: disable=redefined-b
7979
Version.objects.filter(
8080
project=project,
8181
verbose_name=version_name,
82+
type=type,
8283
).update(
8384
identifier=version_id,
84-
type=type,
8585
machine=False,
8686
)
8787

0 commit comments

Comments
 (0)