From b97eee01d0cd203678da7315ccdb4b4474491ffb Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 28 Aug 2005 20:22:04 +0000 Subject: [PATCH] Basic SVNCommon lib setup --- includes/svnlib.php | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/includes/svnlib.php b/includes/svnlib.php index 451cbcf..6f0e835 100644 --- a/includes/svnlib.php +++ b/includes/svnlib.php @@ -31,6 +31,12 @@ class SVNLib */ var $svnpath; + /** + * Common command system + * @var object + */ + var $common; + /** * Constructor: validate SVN path * @@ -42,6 +48,8 @@ class SVNLib $this->svnpath = $viewsvn->shell->cmd($svnpath); + $this->common =& new SVNCommon(); + $access = $viewsvn->shell->exec($this->svnpath . ' --version'); if (!$access) @@ -274,6 +282,56 @@ class SVNLib } } +/** +* Commonly executed SVN commands that return data +* used in many parts of the system +* +* @package ViewSVN +* @version $Id$ +*/ +class SVNCommon +{ + /** + * Registry object + * @var object + */ + var $registry; + + /** + * 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->cat($this->registry->paths->fetch_repos($path), $this->registry->paths->fetch_path($path), 'HEAD'); + $output = implode("\n", $output); + if (strpos($output, 'svn:') === false) + { + return false; + } + else + { + return true; + } + } +} + /** * Annotation/blame system; constructs an array * that is ready for output -- 2.43.5