Get the base commit hash for a Revision

Hi all,

I’m pretty new to phabricator and its source code, so apologies for the newbie question.

My org uses phabricator for code review and we use a plugin very very similar to this one by x-lab-ltd to help us trigger a build on TeamCity and relay some information back. This leverages the HarbormasterBuildStepImplementation to do its thing.

We are now running into a use case for which I need the base commit hash to be present in the information that is sent in the request from Phabricator-Harbormaster to TeamCity.

This seems to be fetched in the source code of phabricator by doing a $diff->getSourceControlBaseRevision(). I’m wondering what’s a good way to surface this information using the plugin. Any help/pointers to set me on the right direction would be super helpful.

Cheers,
Santhosh

I found what I could do. I have the Diff ID, so I did this which helped me get what I want:

$diff = id(new DifferentialDiffQuery())
  ->setViewer($viewer)
  ->withIDs(array($variables['buildable.diff']))
  ->needChangesets(true)
  ->executeOne();
$baseCommitHash = $diff->getDiffDict()["sourceControlBaseRevision"];