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

Only use remote branches for our syncing. #4984

Merged
merged 3 commits into from
Dec 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions readthedocs/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class CommunityTestSettings(CommunityDevSettings):

DEBUG = False
TEMPLATE_DEBUG = False
LOCAL_GIT_BRANCHES = True

@property
def LOGGING(self): # noqa - avoid pep8 N802
Expand Down
6 changes: 4 additions & 2 deletions readthedocs/vcs_support/backends/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import git
from builtins import str
from django.core.exceptions import ValidationError
from django.conf import settings
from git.exc import BadName

from readthedocs.config import ALL
Expand Down Expand Up @@ -177,12 +178,13 @@ def tags(self):
def branches(self):
repo = git.Repo(self.working_dir)
versions = []
branches = []

# ``repo.branches`` returns local branches and
branches = repo.branches
# ``repo.remotes.origin.refs`` returns remote branches
if repo.remotes:
branches += repo.remotes.origin.refs
if getattr(settings, 'LOCAL_GIT_BRANCHES', False):
branches += repo.branches

for branch in branches:
verbose_name = branch.name
Expand Down