Home > Backend Development > PHP Tutorial > PHP运行SVN命令显示某用户的文件更新记录的代码_PHP

PHP运行SVN命令显示某用户的文件更新记录的代码_PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 11:58:14
Original
849 people have browsed it

复制代码 代码如下:
$user=trim($_GET['user']);
$d=$_GET['date'];
if(!$d){
 $d=date('Ymd',time()-86400*14);
}
if(empty($user)){
 echo "例如:svn_log.php?user=wang&date=20130118";
 exit;
}

$cmd='/usr/bin/svn log -v -r {'.$d.'}:"HEAD" --username 用户名 --password 密码 --no-auth-cache | sed -n "/'.$user.'/,/-----$/ p" 2>&1';

$p=dirname(__FILE__);

exec('cd '.$p,$output);

exec($cmd,$output);

$d=date('Y年m月d日',strtotime($d));
echo $user.'自'.$d.'以来:
';
echo '---------------------------------------------
';
$out='';

krsort($output);

if(!empty($output)){
 foreach($output as $v){
  $p1=strpos($v,'/branch/');
  $p2=strpos($v,'/tg/');
  if($p1!==false || $p2!==false){
   if($p1!==false){
    $v=substr($v,$p1+9);
   }else{
    $v=substr($v,$p2+4);
   }
   if($out==''){
    $out=$v;
    echo $v.'
';
   }else{
    if(strpos($out,$v)===false){
     $out.=','.$v;
     echo $v.'
';
    }
   }
  }
 }
}else{
 echo "没有文件";
}
?>

Related labels:
svn
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Git and SVN
From 1970-01-01 08:00:00
0
0
0
php - SVN commit file failed
From 1970-01-01 08:00:00
0
0
0
How to configure apache to access svn
From 1970-01-01 08:00:00
0
0
0
git svn clone cannot get the code
From 1970-01-01 08:00:00
0
0
0
svn migrate git
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template