Skip to content

Commit ebd291d

Browse files
authored
Merge pull request atlassian-api#277 from aK0nshin/add-get-default-branch
Implement get_default_branch method in bitbucket resourse
2 parents d5d7a55 + 77b4272 commit ebd291d

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
@@ -413,6 +413,18 @@ def get_branches(self, project, repository, base=None, filter=None, start=0, lim
413413

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

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

0 commit comments

Comments
 (0)