TQ\Svn\Repository\Repository::getCurrentCommit PHP Method

getCurrentCommit() public method

Returns the current commit hash
public getCurrentCommit ( ) : string
return string
    public function getCurrentCommit()
    {
        /** @var $result CallResult */
        $result = $this->getSvn()->{'info'}($this->getRepositoryPath(), array('--xml', '--revision' => 'HEAD'));
        $result->assertSuccess(sprintf('Cannot get info for "%s"', $this->getRepositoryPath()));
        $xml = simplexml_load_string($result->getStdOut());
        if (!$xml) {
            throw new \RuntimeException(sprintf('Cannot read info XML for "%s"', $this->getRepositoryPath()));
        }
        $commit = $xml->xpath('/info/entry/commit[@revision]');
        if (empty($commit)) {
            throw new \RuntimeException(sprintf('Cannot read info XML for "%s"', $this->getRepositoryPath()));
        }
        $commit = reset($commit);
        return (string) $commit['revision'];
    }