Hi Atlassian Team,
We have BitBucket Source Code Review Plugin which is in-house developed one and installed in Bitbucket.
We are using the method commitService.getCommitsBetween(commitsBetweenRequest, pr) which is there in Atlassian SDK.
public List getPullCommits(PullRequest pull) {
EscalatedSecurityContext secCtx = securityService.withPermission(Permission.REPO_READ, “********”);
List commits = secCtx.call((UncheckedOperation<List>) () → {
CommitsBetweenRequest.Builder builder = new CommitsBetweenRequest.Builder(pull);
PullRequestRef toRef = pull.getToRef();
builder.include(toRef.getId());
CommitsBetweenRequest commitsBetweenRequest = builder.build();
Iterable pullCommits = new PagedIterable<>(pr → commitService.getCommitsBetween(commitsBetweenRequest, pr), 100);
List items = new ArrayList<>();
pullCommits.forEach(items::add);
return items;
});
return commits;
}
We are getting commits from highlighted code. We are not using any endpoints from Atlassian Document.
We have below observation in bitbucket api.
We are getting other pull request commits in the pull request.
The pull request 1609 is having one commit(7ad3b185e8c) only.
But the BB API for the pull request 1609 is fetching commits of Other Pull request 1610(83e4bdc718c,5656be56d38) and 1611(5656be56d38).
Although display id 5656be56d38 is part of pull request 1611 and display id 83e4bdc718c is part of 1610.
dbscr Request
/rest/sdlc/1.0/scrTags?projectKey=SDLC&repoSlug=sdlc-portal&lrt=T100&crt=T101 which is using below method internally commitService.getCommitsBetween(commitsBetweenRequest, pr).
BB method is giving below response.
{
"status": "ok",
"result": {
"rejected": [
{
"displayId": "7ad3b185e8c",
"timestamp": "2022-05-31T09:00:15.000+0200",
"authorEmail": tushar.behere@db.com,
"reason": "[
PullRequestId:1611 commitid:8202846d263::SIZE2,
PullRequestId:1611 commitid:5656be56d38::SIZE1
PullRequestId:1610 commitid:8202846d263::SIZE2,
PullRequestId:1610 commitid:9d90cc987fb::SIZE2,
PullRequestId:1610 commitid:5656be56d38::SIZE1,
PullRequestId:1610 commitid:83e4bdc718c::SIZE1
PullRequestId:1609 commitid:8202846d263::SIZE2,
PullRequestId:1609 commitid:9d90cc987fb::SIZE2,
PullRequestId:1609 commitid:13c985bc6d4::SIZE2,
**PullRequestId:1609 commitid:7ad3b185e8c::SIZE1**
PullRequestId:1609 commitid:5656be56d38::SIZE1,
PullRequestId:1609 commitid:83e4bdc718c::SIZE1,
Pull request #1609 is self-approved",
"reviewers": [
vibhav-kumar.rai
],
"pullRequestNo": 1609
}
],
"accepted": []
}
}
Could you please assist us in identifying this problem.