It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Check changed files in pull request

Kyle Nicholls May 14, 2014

I'm writing a plugin that will flag changed files in a pull request and block it from being merged.

I have a merge request check, the only part I can figure out is how to get a list of files changed for the pull request. I see these is a simple way to get changed files from rest api, is there a good way to do this in a plugin?

3 answers

1 accepted

1 vote
Answer accepted
Michael Heemskerk Atlassian Team May 14, 2014

Hi Kyle,

I think you're looking for PullRequestService#streamChanges



Kyle Nicholls May 15, 2014

That was quick, thanks! Exactly what I was looking for. I looked at that page before but thought it was just for managing comments on a pull request.

anil kumar May 22, 2014

Hi All,

I tried to implement for pullrequest#streamChanges

pullRequestService.streamChanges(prOpEvent.getPullRequest().getToRef().getRepository().getId(), prOpEvent.getPullRequest().getId(), new ChangeCallback() {


public void onStart() throws IOException { }


public void onEnd(boolean arg0) throws IOException { }


public boolean onChange(Change change) throws IOException {

//filePath = change.getPath().getName();

//here im updating the file paths to


return false;



I commited the mutiple files but im not getting all of them..

same problem im facing wit commitservice#streamChanges().




Kyle Nicholls May 22, 2014
return false;

In your onChange method when you return false this ends the change stream. Return true to tell it to grab the next change.

Also you're using a deprecated method, you should do something like this instead:

pullRequestService.streamChanges(new PullRequestChangesRequest.Builder(pullRequest).build(), new ChangeCallback() {

0 votes
anil kumar May 22, 2014

hi Kyle,

Good point...Il check and let you know



0 votes
anil kumar May 22, 2014

Thanks Kyle.

return false was the problem..

Kyle Nicholls May 22, 2014

No problem! Glad I could help.

anil kumar May 28, 2014

Hi Kyle,

I have problem while creating pull requests with REST API and posted in this

Any suggestion please.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

1,937 views 1 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you