Skip to content

Commit 03c7bd8

Browse files
committed
OJ-54337 Use repo slug for bitbucket URLs
1 parent 6f1ff85 commit 03c7bd8

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

jf_agent/git/bitbucket_cloud_adapter.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,10 @@ def get_pull_requests(
265265
@diagnostics.capture_timing()
266266
@logging_helper.log_entry_exit(logger)
267267
def get_branches(self, project, api_repo) -> List[StandardizedBranch]:
268+
repo_slug = api_repo['full_name'].split('/')[-1]
268269
return [
269270
_standardize_branch(api_branch, self.config.git_redact_names_and_urls)
270-
for api_branch in self.client.get_branches(project.id, api_repo['uuid'])
271+
for api_branch in self.client.get_branches(project.id, repo_slug)
271272
]
272273

273274

@@ -281,6 +282,7 @@ def _standardize_repo(
281282
standardized_project: StandardizedProject,
282283
redact_names_and_urls: bool,
283284
) -> StandardizedRepository:
285+
repo_slug = api_repo['full_name'].split('/')[-1]
284286
repo_name = (
285287
api_repo['name']
286288
if not redact_names_and_urls
@@ -289,7 +291,7 @@ def _standardize_repo(
289291
url = api_repo['links']['self']['href'] if not redact_names_and_urls else None
290292

291293
return StandardizedRepository(
292-
id=api_repo['uuid'],
294+
id=repo_slug,
293295
name=repo_name,
294296
full_name=api_repo['full_name'],
295297
url=url,
@@ -305,8 +307,9 @@ def _standardize_repo(
305307

306308

307309
def _standardize_short_form_repo(api_repo, redact_names_and_urls):
310+
repo_slug = api_repo['full_name'].split('/')[-1]
308311
return StandardizedShortRepository(
309-
id=api_repo['uuid'],
312+
id=repo_slug,
310313
name=(
311314
api_repo['name']
312315
if not redact_names_and_urls
@@ -480,7 +483,7 @@ def _standardize_pr(
480483
and api_pr['merge_commit'].get('hash')
481484
):
482485
api_merge_commit = client.get_commit(
483-
repo.project.id, api_pr['source']['repository']['uuid'], api_pr['merge_commit']['hash']
486+
repo.project.id, repo.id, api_pr['merge_commit']['hash']
484487
)
485488
merge_commit = _standardize_commit(
486489
api_merge_commit,

0 commit comments

Comments
 (0)