Skip to content

Commit 77b4272

Browse files
author
Коншин Александр Алексеевич
committed
Implement get_default_branch method in bitbucket resourse
1 parent 2a88f25 commit 77b4272

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

atlassian/bitbucket.py

+12
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,18 @@ def get_branches(self, project, repository, base=None, filter=None, start=0, lim
414414

415415
return (self.get(url, params=params) or {}).get('values')
416416

417+
def get_default_branch(self, project, repository):
418+
"""
419+
Get the default branch of the repository.
420+
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
421+
:param project:
422+
:param repository:
423+
:return:
424+
"""
425+
url = 'rest/api/1.0/projects/{project}/repos/{repository}/branches/default'.format(project=project,
426+
repository=repository)
427+
return self.get(url)
428+
417429
def create_branch(self, project_key, repository, name, start_point, message=""):
418430
"""Creates a branch using the information provided in the request.
419431

0 commit comments

Comments
 (0)