From 97348c2903632e8a3d994846ba6864d46b091fdf Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 22 Jan 2006 01:47:14 +0000 Subject: [PATCH] Removing the stuff in SVNCommon2 (except for 1 function) as it's all part of Node_Controller now --- includes/svncommon.php | 227 ----------------------------------------- 1 file changed, 227 deletions(-) diff --git a/includes/svncommon.php b/includes/svncommon.php index f40d66c..b7745d5 100644 --- a/includes/svncommon.php +++ b/includes/svncommon.php @@ -40,12 +40,6 @@ class SVNCommon */ var $svnpath; - /** - * Common command system - * @var object - */ - var $common; - /** * Constructor: validate SVN path * @@ -57,8 +51,6 @@ class SVNCommon $this->svnpath = $viewsvn->shell->cmd($svnpath); - $this->common =& new SVNCommon2(); - $access = $viewsvn->shell->exec($this->svnpath . ' --version'); if (!$access) @@ -207,225 +199,6 @@ class SVNCommon return $thestring; } -} - -/** -* Commonly executed SVN commands that return data -* used in many parts of the system -* -* @package ViewSVN -* @version $Id$ -*/ -class SVNCommon2 -{ - /** - * Registry object - * @var object - */ - var $registry; - - /** - * List of revisions - * @var array - */ - var $revisions; - - /** - * List of logs - * @var array - */ - var $logs; - - /** - * Constructor: bind with registry - */ - function SVNCommon() - { - global $viewsvn; - - $this->registry =& $viewsvn; - } - - /** - * Checks to see if the given universal path is - * a directory - * - * @access public - * - * @param string Universal path - * - * @return bool Directory or not - */ - function isdir($path) - { - $output = $this->registry->svn->std('info', $this->registry->paths->fetch_repos($path), $this->registry->paths->fetch_path($path), $this->registry->paths->revnum); - - foreach ($output AS $line) - { - if (preg_match('#^Node Kind: (.*)#', $line, $matches)) - { - if (trim(strtolower($matches[1])) == 'directory') - { - return true; - } - } - } - - return false; - } - - /** - * Get a list of revisions for a path - * - * @access public - * - * @param string Universal path - * - * @return array Key revisions - */ - function fetch_revs($path) - { - if (!isset($this->revisions["$path"])) - { - $log = $this->fetch_logs($path); - - $revs = array_keys($log); - - $this->revisions["$path"] = array( - 'HEAD' => $revs[0], - 'START' => $revs[ count($revs) - 1 ], - 'revs' => $revs - ); - } - - return $this->revisions["$path"]; - } - - /** - * Gets the revision that is marked as HEAD - * - * @access public - * - * @param string Universal path - * - * @return integer Revision - */ - function fetch_head_rev($path) - { - $output = $this->registry->shell->exec($this->registry->svn->svnpath . ' info ' . $this->registry->repos->fetch_path($this->registry->paths->fetch_repos($path), false) . $this->registry->paths->fetch_path($path)); - - foreach ($output AS $line) - { - if (preg_match('#^Last Changed Rev: (.*)#', $line, $matches)) - { - return $matches[1]; - } - } - - $revs = $this->fetch_revs($path); - return $revs['HEAD']; - } - - /** - * Returns the previous revision to the one given - * - * @access public - * - * @param string Universal path - * @param integer Arbitrary revision - * - * @return integer Previous revision (-1 if none) - */ - function fetch_prev_rev($path, $current) - { - global $viewsvn; - - $revs = $this->fetch_revs($path); - - if ($current == 'HEAD') - { - $current = $this->fetch_head_rev($path); - } - - $index = array_search($current, $revs['revs']); - if ($current === false) - { - $message->trigger->error(sprintf($viewsvn->lang->string('Revision r%1$s is not in path %2$s'), $current, $path)); - } - - if (isset($revs['revs'][ $index + 1 ])) - { - return $revs['revs'][ $index + 1 ]; - } - else - { - return -1; - } - } - - /** - * Get a list of logs - * - * @access public - * - * @param string Universal path - * @param bool Override the cache system? - * - * @return array Log data - */ - function fetch_logs($path) - { - if (!isset($this->logs["$path"])) - { - $log = new SVNLog($this->registry->paths->fetch_repos($path), $this->registry->paths->fetch_path($path), 0, $this->registry->paths->revnum); - - $this->logs["$path"] = $log->fetch(); - } - - return $this->logs["$path"]; - } - - /** - * Returns a given log entry for a path - * and revision - * - * @access public - * - * @param string Universal path - * @param integer Arbitrary revision - * - * @return array Log entry - */ - function fetch_log($path, $rev) - { - $logs = $this->fetch_logs($path); - - $rev = $this->registry->svn->rev($rev); - if ($rev == 'HEAD') - { - $rev = $this->fetch_head_rev($path); - } - - if (isset($logs["$rev"])) - { - return $logs["$rev"]; - } - else - { - $keys = array_keys($logs); - sort($keys); - - for ($i = 0; $i < count($keys); $i++) - { - if ($rev > $keys["$i"] AND $rev < $keys[ $i + 1 ]) - { - return $logs["$keys[$i]"]; - } - } - - return null; - } - } /** * Prints the file changed list -- 2.43.5