Skip to content

Commit 7caa34f

Browse files
authored
Fix broken Bitbucket Cloud client (#611)
* Fix typo in function call * Set resource_url default values * Apply formatting * Support alternative Bitbucket Cloud URL * Fix more broken stuff Missing function call arguments, typos, SonarLint errors etc. * Normalize argument names * Apply formatting
1 parent a9c6159 commit 7caa34f

7 files changed

+342
-335
lines changed

atlassian/bitbucket.py

Lines changed: 329 additions & 322 deletions
Large diffs are not rendered by default.

atlassian/rest_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def log_curl_debug(self, method, url, data=None, headers=None, level=logging.DEB
120120
url=url)
121121
log.log(level=level, msg=message)
122122

123-
def resource_url(self, resource, api_root, api_version):
123+
def resource_url(self, resource, api_root=None, api_version=None):
124124
if api_root is None:
125125
api_root = self.api_root
126126
if api_version is None:

examples/bitbucket/bitbucket-branch-restrictions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
matcher_type="branch", # lowercase matcher type
1717
matcher_value="master",
1818
permission_type="no-deletes",
19-
repository="repository_name",
19+
repository_slug="repository_name",
2020
except_users=["user1", "user2"]
2121
)
2222
print(single_permission)
@@ -74,7 +74,7 @@
7474
matcher_type="branch",
7575
matcher_value="master",
7676
permission_type="no-deletes",
77-
repository="repository_name",
77+
repository_slug="repository_name",
7878
except_users=["user1", "user2"]
7979
)
8080
print(multiple_permissions)

examples/bitbucket/bitbucket-changes-between-branches.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
password='admin')
88

99
changelog = bitbucket.get_changelog(
10-
project='DEMO',
11-
repository='example-repository',
10+
project_key='DEMO',
11+
repository_slug='example-repository',
1212
ref_from='develop',
1313
ref_to='master')
1414

examples/bitbucket/bitbucket-clean-jira-branches.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def is_can_removed_branch(branch_candidate):
9393
last_date_commit = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(committer_time_stamp))
9494
if is_can_removed_branch(branch):
9595
if not DRY_RUN:
96-
stash.delete_branch(project=PROJECT_KEY, repository=repository, name=display_id,
96+
stash.delete_branch(project_key=PROJECT_KEY, repository_slug=repository, name=display_id,
9797
end_point=branch['latestCommit'])
9898
log.write("{},{},{}\n".format(display_id, last_date_commit, True))
9999
step += 1

examples/bitbucket/bitbucket-fork-repository.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
password='admin')
88

99
data = bitbucket.fork_repository(
10-
project='DEMO',
11-
repository='example-repository',
12-
new_repository='forked-repository')
10+
project_key='DEMO',
11+
repository_slug='example-repository',
12+
new_repository_slug='forked-repository')
1313

1414
print(data)

examples/bitbucket/bitbucket-tag-manipulations.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
password='admin')
1010

1111
if __name__ == '__main__':
12-
response = bitbucket.set_tag(project='gonchik.tsymzhitov',
13-
repository='gonchik',
12+
response = bitbucket.set_tag(project_key='gonchik.tsymzhitov',
13+
repository_slug='gonchik',
1414
tag_name='test1',
1515
commit_revision='ebcf5fdffa0',
1616
description='Stable release')
1717
print("Response after set_tag method")
1818
print(response)
1919

20-
response = bitbucket.get_project_tags(project='INT', repository='jira-plugins', tag_name='test1')
20+
response = bitbucket.get_project_tags(project_key='INT', repository_slug='jira-plugins', tag_name='test1')
2121
print("Retrieve tag")
2222
print(response)
2323
print("Remove tag")
24-
bitbucket.delete_tag(project='INT', repository='jira-plugins', tag_name='test1')
24+
bitbucket.delete_tag(project_key='INT', repository_slug='jira-plugins', tag_name='test1')

0 commit comments

Comments
 (0)