Skip to content
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
20 changes: 17 additions & 3 deletions atlassian/bitbucket/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1236,8 +1236,11 @@ def set_tag(self, project_key, repository_slug, tag_name, commit_revision, descr
if tag_name is not None:
body["name"] = tag_name
if tag_name is not None:
body["startPoint"] = commit_revision
if tag_name is not None:
if self.cloud:
body["target"] = {"hash": commit_revision}
else:
body["startPoint"] = commit_revision
if tag_name is not None and not self.cloud:
body["message"] = description
return self.post(url, data=body)

Expand Down Expand Up @@ -1971,6 +1974,7 @@ def get_commits(
avatar_size=None,
avatar_scheme=None,
limit=None,
branch=""
):
"""
Get commit list from repo
Expand All @@ -1989,6 +1993,8 @@ def get_commits(
:return:
"""
url = self._url_commits(project_key, repository_slug)
if branch:
url = "{}/{}".format(url, branch)
params = {"merges": merges}
if hash_oldest:
params["since"] = hash_oldest
Expand All @@ -2006,7 +2012,15 @@ def get_commits(
params["avatarScheme"] = avatar_scheme
if limit:
params["limit"] = limit
return (self.get(url, params=params) or {}).get("values")
commits = []
response = (self.get(url, params=params) or {})
if response is {}:
return []
commits += response.get('values')
while len(commits) < limit and 'next' in response.keys():
response = self.get(response['next'], absolute=True)
commits += response.get('values')
return commits[:limit] if len(commits) > limit else commits

def _url_commit(self, project_key, repository_slug, commit_id, api_root=None, api_version=None):
return "{}/{}".format(
Expand Down