Skip to content
Merged
Show file tree
Hide file tree
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
21 changes: 20 additions & 1 deletion atlassian/bitbucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,24 +1081,43 @@ def get_diff(self, project, repository, path, hash_oldest, hash_newest):
params['to'] = hash_newest
return (self.get(url, params=params) or {}).get('diffs')

def get_commits(self, project, repository, hash_oldest, hash_newest, limit=99999):
def get_commits(self, project, repository, hash_oldest=None, hash_newest=None, follow_renames=False,
ignore_missing=False, merges="include", with_counts=False,
avatar_size=None, avatar_scheme=None, limit=99999):
"""
Get commit list from repo
:param project:
:param repository:
:param hash_oldest:
:param hash_newest:
:param merges: OPTIONAL: include|exclude|only if present, controls how merge commits should be filtered.
:param follow_renames: OPTIONAL: if true, the commit history of the specified file will be followed past renames.
:param ignore_missing: OPTIONAL: true to ignore missing commits, false otherwise
:param with_counts: OPTIONAL: optionally include the total number of commits and total number of unique authors
:param avatar_size: OPTIONAL: if present the service adds avatar URLs for commit authors.
:param avatar_scheme: OPTIONAL: the desired scheme for the avatar URL
:param limit: OPTIONAL: The limit of the number of commits to return, this may be restricted by
fixed system limits. Default by built-in method: 99999
:return:
"""
url = 'rest/api/1.0/projects/{project}/repos/{repository}/commits'.format(project=project,
repository=repository)
params = {}
params["merges"] = merges
if hash_oldest:
params['since'] = hash_oldest
if hash_newest:
params['until'] = hash_newest
if follow_renames:
params['followRenames'] = follow_renames
if ignore_missing:
params['ignoreMissing'] = ignore_missing
if with_counts:
params['withCounts'] = with_counts
if avatar_size:
params['avatarSize'] = avatar_size
if avatar_scheme:
params['avatarScheme'] = avatar_scheme
if limit:
params['limit'] = limit
return (self.get(url, params=params) or {}).get('values')
Expand Down
27 changes: 27 additions & 0 deletions examples/confluence-attach-file-as-link.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# coding=utf-8
from atlassian import Confluence
from datetime import datetime
import logging


confluence = Confluence(
url='http://localhost:8090',
username='admin',
password='admin',
)

logging.basicConfig(level=logging.DEBUG)

filename = "test_file.txt"
with open(filename, "w") as f:
f.write(str(datetime.utcnow()))

confluence.attach_file(filename, page_id="123456789")

link = """<p>
<ac:link>
<ri:attachment ri:filename="{}"/>
</ac:link>
</p>""".format(filename)

confluence.append_page(123456789, "Page Title", link)