Skip to content

Commit

Permalink
Clean up repo_url parsing stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericholscher committed Aug 21, 2014
1 parent 73cd491 commit b6a70ba
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions readthedocs/vcs_support/backends/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,15 @@ def __init__(self, *args, **kwargs):
self.repo_url = self._get_clone_url()

def _get_clone_url(self):
user_repo_url = self.repo_url
if '://' in user_repo_url:
hacked_url = user_repo_url.split('://')[1].rstrip('.git')
else:
raise ProjectImportError(
"Invalid project url: %s" % user_repo_url
)

clone_url = 'https://%s' % hacked_url
if self.token:
clone_url = 'https://%s@%s' % (self.token, hacked_url)

return clone_url
if '://' in self.repo_url:
hacked_url = self.repo_url.split('://')[1].rstrip('.git')
clone_url = 'https://%s' % hacked_url
if self.token:
clone_url = 'https://%s@%s' % (self.token, hacked_url)
else:
clone_url = 'https://%s' % (hacked_url)
return clone_url
return self.repo_url

def set_remote_url(self, url):
return self.run('git', 'remote', 'set-url', 'origin', url)
Expand Down

0 comments on commit b6a70ba

Please sign in to comment.