How to run git commands from plugin SDK

In Bitbucket 8.8.2 how to use com.atlassian.bitbucket.scm interface ScmCommandFactory?
I want to use diff method as listed on javadoc but cannot find a way to use the interface. Class which implement this interface is not documented. I wan to get to diff between 2 commits and also run git log but SDK documentation is not clear. Earlier version have GitScmCommandBuilder to run GIT commands.
diff(DiffCommandParameters parameters, DiffContentCallback callback)

Here’s a snippet from one of my plugins (Control Freak) - works fine on Bitbucket 8.15.0:

Repository r = // obtain this somehow
SingleLineOutputHandler h = new SingleLineOutputHandler();
GitScmCommandBuilder revListBuilder = gitBuilderFactory.builder(r).command("rev-list");
revListBuilder.argument("--pretty=%H,%P%x04%aN <%aE>%x02%cN <%cE>");
GitCommand<String> revsCmd =;
String newPushedCommits =;