/**
* List the directory at a given version
*
* @param string $directory The path ot the directory
* @param string $ref The version ref
* @return array
* @throws \RuntimeException
*/
public function listDirectory($directory = '.', $ref = 'HEAD')
{
$directory = FileSystem::normalizeDirectorySeparator($directory);
$directory = rtrim($directory, '/') . '/';
$args = array('--xml', '--revision' => $ref, $this->resolveLocalPath($directory));
/** @var $result CallResult */
$result = $this->getSvn()->{'list'}($this->getRepositoryPath(), $args);
$result->assertSuccess(sprintf('Cannot list directory "%s" at "%s" from "%s"', $directory, $ref, $this->getRepositoryPath()));
$xml = simplexml_load_string($result->getStdOut());
if (!$xml) {
throw new \RuntimeException(sprintf('Cannot read list XML for "%s" at "%s" from "%s"', $directory, $ref, $this->getRepositoryPath()));
}
$list = array();
foreach ($xml->xpath('/lists/list/entry') as $item) {
$list[] = (string) $item->name;
}
return $list;
}