Need to get a handle to all files in a pull request prior to being merged in


I am trying to write a merge hook plugin that will allow me to get a handle to all files in a pull request before being merged. I need to run additional integrity checks on the files in pull request. Any tips or pointers would be appreciated.

For anyone else who is looking for this.

public class MyPostRepoHook implements PostRepositoryHook<RepositoryHookRequest> {

   private ScmService scmService;

   public MyPostRepoHook( @ComponentImport final ScmService scmService ) {
      this.scmService = scmService;

   public void postUpdate( PostRepositoryHookContext context, RepositoryHookRequest request ) {

            .forEach( refChange -> scmService.getBulkContentCommandFactory( request.getRepository() )
               .contents( new BulkContentCommandParameters.Builder( refChange.getToHash() )
                  .sinceCommitId( refChange.getFromHash() )
                  .build(), new BulkContentCallback() {
                  public void onFile( @Nonnull BulkFile file, @Nonnull InputStream content ) {

                       //Implement here

               } ).call() );