Skip to content

Extend the shared library to provide more data for Bitbucket PRs #4128

@sergeibbb

Description

@sergeibbb

seems to cause #4191

Description

There is a getPullRequestsForUserAndWorkspace method in the shared library. But in #4099 we used the own implementation of it, because the shared library does not provide info about reviewers.

Also we need URLs of head and base repositories, to avoid hacking it like here:

Image

Our current Bitbucket conversion of type is here, all information is collected in one request:

{
base: {
branch: pr.destination.branch.name,
sha: pr.destination.commit.hash,
repo: pr.destination.repository.name,
owner: pr.destination.repository.full_name.split('/')[0],
exists: true,
url: pr.destination.repository.links.html.href,
},
head: {
branch: pr.source.branch.name,
sha: pr.source.commit.hash,
repo: pr.source.repository.name,
owner: pr.source.repository.full_name.split('/')[0],
exists: true,
url: pr.source.repository.links.html.href,
},
isCrossRepository: pr.source.repository.uuid !== pr.destination.repository.uuid,
},
undefined, // isDraft
undefined, // additions
undefined, // deletions
undefined, // commentsCount
undefined, // thumbsCount
getBitbucketReviewDecision(pr),
pr.participants // reviewRequests:PullRequestReviewer[]
?.filter(prt => prt.role === 'REVIEWER')
.map(prt => fromBitbucketParticipantToReviewer(prt, pr.closed_by, pr.state))
.filter(rv => rv.state === PullRequestReviewState.ReviewRequested),
pr.participants // latestReviews:PullRequestReviewer[]
?.filter(prt => prt.participated_on != null)
.map(prt => fromBitbucketParticipantToReviewer(prt, pr.closed_by, pr.state)),

Goals:

  1. the logic should be implemented in the shared library
  2. GitLens should remove the custom implementation and start using the shared library.

Implementation

Verification steps

Check that Bitbucket Cloud pull requests work on Launchpad

  • Their URLs go to right pages
  • Switch to the branch works
  • Merge command works

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions