Skip to content

Commit

Permalink
Merge pull request #6729 from readthedocs/feature-flag-tag-branch-sync
Browse files Browse the repository at this point in the history
Add feature flag for branch & tag syncing to API.
  • Loading branch information
ericholscher authored Mar 3, 2020
2 parents 820c857 + 02281de commit 2dca3d7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion common
13 changes: 12 additions & 1 deletion readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,8 @@ def add_features(sender, **kwargs):
UPDATE_CONDA_STARTUP = 'update_conda_startup'
CONDA_APPEND_CORE_REQUIREMENTS = 'conda_append_core_requirements'
ALL_VERSIONS_IN_HTML_CONTEXT = 'all_versions_in_html_context'
SKIP_SYNC_TAGS = 'skip_sync_tags'
SKIP_SYNC_BRANCHES = 'skip_sync_branches'
SKIP_SYNC = 'skip_sync'

FEATURES = (
Expand Down Expand Up @@ -1572,7 +1574,16 @@ def add_features(sender, **kwargs):
),
),
(
SKIP_SYNC, _('Skip symlinking and file syncing to webs'),
SKIP_SYNC_TAGS,
_('Skip syncing tags'),
),
(
SKIP_SYNC_BRANCHES,
_('Skip syncing branches'),
),
(
SKIP_SYNC,
_('Skip symlinking and file syncing to webs'),
),
)

Expand Down
10 changes: 8 additions & 2 deletions readthedocs/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,19 @@ def sync_versions(self, version_repo):
"""
version_post_data = {'repo': version_repo.repo_url}

if version_repo.supports_tags:
if all([
version_repo.supports_tags,
not self.project.has_feature(Feature.SKIP_SYNC_TAGS)
]):
version_post_data['tags'] = [{
'identifier': v.identifier,
'verbose_name': v.verbose_name,
} for v in version_repo.tags]

if version_repo.supports_branches:
if all([
version_repo.supports_branches,
not self.project.has_feature(Feature.SKIP_SYNC_BRANCHES)
]):
version_post_data['branches'] = [{
'identifier': v.identifier,
'verbose_name': v.verbose_name,
Expand Down

0 comments on commit 2dca3d7

Please sign in to comment.