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

Fix branches/tags for cloud usage #810

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions atlassian/bitbucket/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ def upload_plugin(self, plugin_path):
################################################################################################

def _url_projects(self, api_root=None, api_version=None):
if self.cloud:
return self.resource_url("repositories", api_root, api_version)
Comment on lines +255 to +256
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn*t make sense for me. Why is the URL for projects redirected repositories???

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@Spacetown Spacetown Jul 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats because here it is called workspace and not project. There is an open issue #604. If this API is needed I suggest to add it into the Cloud part of BitBucket.

Copy link
Author

@nborisenko nborisenko Jul 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agreed with you, from my point of view it should be 2 separate clients. But I currently didn't have enough time for move it to cloud class or build new client. This is temporary solution, which allows persons like me use python client with bitbucket.org. Because it`s fully unusable in case when you want to do something with commits/tags/branches in cloud.

return self.resource_url("projects", api_root, api_version)


def project_list(self, start=0, limit=None):
"""
Expand Down Expand Up @@ -695,6 +698,8 @@ def get_project_audit_log(self, project_key, start=0, limit=None):
return self._get_paged(url, params=params)

def _url_repos(self, project_key, api_root=None, api_version=None):
if self.cloud:
return self._url_project(project_key, api_root, api_version)
return "{}/repos".format(self._url_project(project_key, api_root, api_version))

def repo_list(self, project_key, start=0, limit=25):
Expand Down Expand Up @@ -1052,6 +1057,8 @@ def get_repo_audit_log(self, project_key, repository_slug, start=0, limit=None):
return self._get_paged(url, params=params)

def _url_repo_branches(self, project_key, repository_slug, api_root=None):
if self.cloud:
return "{}/refs/branches".format(self._url_repo(project_key, repository_slug, api_root=api_root))
return "{}/branches".format(self._url_repo(project_key, repository_slug, api_root=api_root))

def get_branches(
Expand Down