@@ -44,48 +44,7 @@ def get_version(version_pk):
44
44
version_data = api_v2 .version (version_pk ).get ()
45
45
return APIVersion (** version_data )
46
46
47
- # def get_vcs_repo(self, environment):
48
- # """
49
- # Get the VCS object of the current project.
50
-
51
- # All VCS commands will be executed using `environment`.
52
- # """
53
- # version_repo = self.data.project.vcs_repo(
54
- # version=self.data.version.slug,
55
- # environment=environment,
56
- # verbose_name=self.data.version.verbose_name,
57
- # version_type=self.data.version.type
58
- # )
59
- # return version_repo
60
-
61
- # def sync_repo(self, environment):
62
- # """Update the project's repository and hit ``sync_versions`` API."""
63
- # # Make Dirs
64
- # if not os.path.exists(self.data.project.doc_path):
65
- # os.makedirs(self.data.project.doc_path)
66
-
67
- # if not self.data.project.vcs_class():
68
- # raise RepositoryError(
69
- # _('Repository type "{repo_type}" unknown').format(
70
- # repo_type=self.data.project.repo_type,
71
- # ),
72
- # )
73
-
74
- # # Get the actual code on disk
75
- # log.info(
76
- # 'Checking out version.',
77
- # version_identifier=self.data.version.identifier,
78
- # )
79
- # version_repo = self.get_vcs_repo(environment)
80
-
81
- # self.data.builder.checkout()
82
- # # version_repo.update()
83
-
84
- # self.sync_versions(version_repo)
85
- # identifier = self.data.build_commit or self.data.version.identifier
86
- # version_repo.checkout(identifier)
87
-
88
- def sync_versions (self , version_repo ):
47
+ def sync_versions (self , vcs_repository ):
89
48
"""
90
49
Update tags/branches via a Celery task.
91
50
@@ -97,31 +56,29 @@ def sync_versions(self, version_repo):
97
56
# NOTE: `sync_versions` should receive `tags` and `branches` already
98
57
# and just validate them trigger the task. All the other logic should
99
58
# be done by the DocumentationBuilder or the VCS backend. We should not
100
- # check this here and do not depend on ``version_repo ``.
59
+ # check this here and do not depend on ``vcs_repository ``.
101
60
102
61
tags = None
103
62
branches = None
104
63
if (
105
- version_repo .supports_lsremote and
106
- not version_repo .repo_exists () and
107
- self .data .project .has_feature (Feature .VCS_REMOTE_LISTING )
64
+ vcs_repository .supports_lsremote
65
+ and not vcs_repository .repo_exists ()
66
+ and self .data .project .has_feature (Feature .VCS_REMOTE_LISTING )
108
67
):
109
68
# Do not use ``ls-remote`` if the VCS does not support it or if we
110
69
# have already cloned the repository locally. The latter happens
111
70
# when triggering a normal build.
112
- branches , tags = version_repo .lsremote
113
- log .info ('Remote versions.' , branches = branches , tags = tags )
71
+ branches , tags = vcs_repository .lsremote
114
72
115
73
branches_data = []
116
74
tags_data = []
117
75
118
- if (
119
- version_repo .supports_tags and
120
- not self .data .project .has_feature (Feature .SKIP_SYNC_TAGS )
76
+ if vcs_repository .supports_tags and not self .data .project .has_feature (
77
+ Feature .SKIP_SYNC_TAGS
121
78
):
122
79
# Will be an empty list if we called lsremote and had no tags returned
123
80
if tags is None :
124
- tags = version_repo .tags
81
+ tags = vcs_repository .tags
125
82
tags_data = [
126
83
{
127
84
'identifier' : v .identifier ,
@@ -130,13 +87,12 @@ def sync_versions(self, version_repo):
130
87
for v in tags
131
88
]
132
89
133
- if (
134
- version_repo .supports_branches and
135
- not self .data .project .has_feature (Feature .SKIP_SYNC_BRANCHES )
90
+ if vcs_repository .supports_branches and not self .data .project .has_feature (
91
+ Feature .SKIP_SYNC_BRANCHES
136
92
):
137
93
# Will be an empty list if we called lsremote and had no branches returned
138
94
if branches is None :
139
- branches = version_repo .branches
95
+ branches = vcs_repository .branches
140
96
branches_data = [
141
97
{
142
98
'identifier' : v .identifier ,
@@ -145,6 +101,8 @@ def sync_versions(self, version_repo):
145
101
for v in branches
146
102
]
147
103
104
+ log .debug ("Synchronizing versions." , branches = branches , tags = tags )
105
+
148
106
self .validate_duplicate_reserved_versions (
149
107
tags_data = tags_data ,
150
108
branches_data = branches_data ,
0 commit comments