diff --git a/atlassian/bitbucket.py b/atlassian/bitbucket.py index 743fb6ce3..b145d52ed 100644 --- a/atlassian/bitbucket.py +++ b/atlassian/bitbucket.py @@ -1081,13 +1081,21 @@ 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: @@ -1095,10 +1103,21 @@ def get_commits(self, project, repository, hash_oldest, hash_newest, limit=99999 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') diff --git a/examples/confluence-attach-file-as-link.py b/examples/confluence-attach-file-as-link.py new file mode 100644 index 000000000..3444e620c --- /dev/null +++ b/examples/confluence-attach-file-as-link.py @@ -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 = """

+ + + +

""".format(filename) + +confluence.append_page(123456789, "Page Title", link) \ No newline at end of file