您好,欢迎访问一九零五行业门户网

php svn操作类

以前我们开发大型项目时都会用到svn来同步,因为开发产品的人过多,所以我们会利用软件来管理,今天发有一居然可以利用php来管理svn哦,好了看看吧。
代码如下 复制代码
entry[0]->attributes() as $key=>$value){
if ('revision' == $key) {
return $value;
}
}
}
static public function getheadrevision($path)
{
$command = cd $path && svn up;
$output = svnpeer::runcmd($command);
$output = implode('
', $output);
preg_match_all(/[0-9]+/, $output, $ret);
if (!$ret[0][0]){
return
. $command .
. $output;
}
return $ret[0][0];
}
/**
* run a cmd and return result
*
* @param string command line
* @param boolen true need add the svn authentication
* @return array the contents of the output that svn execute
*/
static protected function runcmd($command)
{
$authcommand = ' --username ' . svn_username . ' --password ' . svn_password . ' --no-auth-cache --non-interactive --config-dir '.svn_config_dir.'.subversion';
exec($command . $authcommand . 2>&1, $output);
return $output;
}
}
文章地址:
转载随意^^请带上本文地址!
其它类似信息

推荐信息