douqian8238 2013-05-13 16:00
浏览 64
已采纳

将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.

  • 写回答

2条回答 默认 最新

  • dongxiangxie8181 2013-05-13 16:03
    关注

    You can ask svn if the directory exists. If you want your add function to mimic the svn one, just throw your Exception and have the caller deal with it. If you want it be silent when the directory already existsm add the check here.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 srs-sip外部服务 webrtc支持H265格式
  • ¥15 在使用abaqus软件中,继承到assembly里的surfaces怎么使用python批量调动
  • ¥15 大一C语言期末考试,求帮助🙏🙏
  • ¥15 ch340驱动未分配COM
  • ¥15 Converting circular structure to JSON
  • ¥30 Hyper-v虚拟机相关问题,求解答。
  • ¥15 TSM320F2808PZA芯片 Bootloader
  • ¥45 谷歌浏览器出现开发者工具无法显示已创建的,但您可以调试已部署的代码。 状态代码 404, net::ERR HTTP RESPONSE CODE FAILURE
  • ¥15 如何解决蓝牙通话音频突发失真问题
  • ¥15 安装opengauss数据库报错