From a7b62a30ff1635991d665443ef01830742924356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20d=27Anterroches?= Date: Sun, 9 Jan 2011 13:47:07 +0100 Subject: [PATCH] Correctly mark a Subversion repository as empty when at revision 0. --- src/IDF/Scm/Svn.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/IDF/Scm/Svn.php b/src/IDF/Scm/Svn.php index 0144738..ce90403 100644 --- a/src/IDF/Scm/Svn.php +++ b/src/IDF/Scm/Svn.php @@ -48,6 +48,25 @@ class IDF_Scm_Svn extends IDF_Scm public function isAvailable() { + $cmd = sprintf(Pluf::f('svn_path', 'svn').' info --xml --username=%s --password=%s %s', + escapeshellarg($this->username), + escapeshellarg($this->password), + escapeshellarg($this->repo)); + $cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd; + $xmlInfo = self::shell_exec('IDF_Scm_Svn::isAvailable', $cmd); + + try { + $xml = simplexml_load_string($xmlInfo); + } + catch (Exception $e) { + return false; + } + if (!isset($xml->entry->commit['revision'])) { + return false; + } + if (0 == (int)$xml->entry->commit['revision']) { + return false; + } return true; }