How can I merge from one branch to another on a pull request

Hi,
Sorry if this has been asked before. I did do a search before posting.
I am trying to hook onto a pull request and apply that change(s) to another branch. I am aware that the server does support auto merge but our branch structure does not allow us to take advantage of this feature.
So far I have a class implementing PostRepositoryHook and I can see that it does get called on a pull request merge. I am able to detect the branch the pull request applies to (We want to only act on pull requests to a particular branch). On looking at the auto-merge code from previous stash server stash-auto-merge-plugin I can see that they call merge on scm command factory but the later versions of the api do not seem to support that call.
Can someone help?
Thanks