将SVN与PHP一起使用 - 在现有目录上添加命令失败

So basically I want to be able to do this:

        /*
            Runs command and checks return code of last command run. Throws SVN exception if non-zero status code is returned. The output of the command otherwise.
        */
        public static function runCommand($cmd)
        {
            //Redirect error to stdout
            $cmd .= " 2>&1";

            $output = array();
            exec($cmd, $output, $status);
            $output = implode("
", $output);

            if($status != 0)
            {
                            //custom exception class - nonimportant
                throw new SvnException($output);
            }

            return $output;
        }

The issue is that svn add considers it an error when you try to add a directory that is already under version control so it returns an error status code. Is there anyway to fix this issue without putting in a hack to look for svn add commands and ignore the error if is the "directory already exists one"?

Specifically, is there some SVN commands I can use to tell if the folder is under version controlt, or arguments that I can use so that svn add does not return an error if the directory is already under version control.

查看全部
douqian8238
douqian8238
2013/05/13 16:00
  • php
  • svn
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复