为了账号安全,请及时绑定邮箱和手机立即绑定

svn 检出项目报错

svn 检出项目报错

PHP
HUH函数 2019-03-09 00:01:25
mac svn 检出项目报错,路径是没有问题,缓存清理过(删除auth),哪位大佬知道原因
查看完整描述

1 回答

?
米脂

TA贡献1836条经验 获得超3个赞

可能是svn 版本问题 升级自己svn.

brew update svn

svn 好难用,但是老项目都是svn 我是自己把svn命令封装了

#!/bin/bash
#
# @function SVN 提交工具
# @uses     /bin/bash
# @version  1.0
# @author   Pu ShaoWei
#
# ---------------------------------------------------------------------------------------- #
#
#   ├── Patch   配置
#   │
#   ├── Common
#   │
#   ├── Fcuntion
#   │
#   └── Init
# ---------------------------------------------------------------------------------------- #

PATH=/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin;export PATH
SVN=/usr/bin/svn;
DEPLOY_TOOLS_DIR=`pwd`

# ---------------------------------------- Common ---------------------------------------- #

function validate(){
  if [[ $1 == "" ]]; then
     echo "Param Fail"
     exit 1;
  fi
  for var in $*
  do
    # if [[ $var == $1 ]]; then
    #   continue;
    # fi
    if [[ ! -d $DEPLOY_TOOLS_DIR"/"$var ]];then
      if [[ ! -f $DEPLOY_TOOLS_DIR"/"$var ]];then
        continue;
      fi
    fi
    file_path=$file_path" "$var
  done

  if [[ $file_path == "" ]]; then
     echo "not File"
     return 1;
  fi
  echo $file_path;
}
# ---------------------------------------- Function ---------------------------------------- #

function addCommand(){
  file=$(validate $*);
  if [[ $? == "1" ]]; then
    echo $file
    exit $?;
  fi
  $SVN add $file;
}

function ciCommand()
{
  if [[ $1 != "-m" ]]; then
      echo "svn commit -m '' path "
      exit $?;
  fi
  msg=$2;
  if [[ $msg == "" ]]; then
    echo "Msg Empty!!"
    exit 0;
  fi
  file=$(validate $3);
  if [[ $? == "1" ]]; then
    echo $file
    exit $?;
  fi
  $SVN up;
  $SVN commit -m $msg $file ; # --force-log
}

function revCommand()
{
  file=$(validate $*);
  if [[ $? == "1" ]]; then
    echo $file
    exit $?;
  fi
  $SVN revert $file;
}

function logCommand()
{
  if [[ $2 != "" ]]; then
    $SVN log -v  --search $2 | less;
    exit;
  fi
  $SVN log -v | less;
}

function vgCommand()
{
  echo '=========================================================================='
  echo
  echo ' [添加文件] svn add                                                        '
  echo ' [提交文件] svn commit                                                     '
  echo ' [详细信息] svn info                                                       '
  echo ' [更新信息] svn up                                                         '
  echo ' [删除文件] svn delete                                                     '
  echo ' [查看日志] svn log                                                        '
  echo ' [对比文件] svn diff                                                       '
  echo ' [撤销命令] svn revert                                                     '
  echo ' [更新冲突]

        Select: (p) postpone, (df) diff-full, (e) edit,
                (mc) mine-conflict, (tc) theirs-conflict,
                (s) show all options:
        解析:
        (p)  postpone 把服务器代码和自己的代码都显示出来,供我们解决
        (df) diff-full 命令行显示冲突内容,不好看
        (e)  edit 修改,不要这么做
        (mc) mine-conflict 只使用自己的代码,删除服务器的
        (tc) theirs-conflict 只使用服务器的,删除自己的代码
        (s) show all options 再重新打印一下这个选择日志
                                                                                  '
  echo '=========================================================================='
}

# -----------------------------------     Init      ---------------------------------------- #
case $1 in
        add)
                addCommand $*
                exit $?;
                ;;
        commit)
                m=`echo $2`
                commit=`echo $3`
                path=`echo ${@:4}`
                ciCommand "$m" "$commit" "$path"
                exit $?;
                ;;
        status)
                $SVN status;
                exit $?;
                ;;
        info)
                $SVN info;
                exit $?;
                ;;
        checkout)
                $SVN checkout $2;
                exit $?;
                ;;
        log)
                logCommand $*
                exit $?;
                ;;
        cat)
                $SVN $*
                exit $?;
                ;;
        up)
                $SVN up
                exit $?;
                ;;
        delete)
                $SVN delete $2
                exit $?;
                ;;
        diff)
                $SVN diff $2
                exit $?;
                ;;
        revert)
                revCommand $*
                exit $?;
                ;;
        vg)
                vgCommand $*
                exit $?;
                ;;
        *)
                vgCommand $*;
                exit 1;
esac
查看完整回答
反对 回复 2019-03-18
  • 1 回答
  • 0 关注
  • 576 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信