1. 程式人生 > >mac升級svn--命令列時提示版本過低

mac升級svn--命令列時提示版本過低

問題:在命令列下對專案進行版本管理操作,結果報這樣的錯:

svn: E155021: This client is too old to work with the working copy at
‘/Users/user/works/v1baobao4iphone‘ (format 31).
You need to get a newer Subversion client. For more details, see
http://subversion.apache.org/faq.html#working-copy-format-change
原因:命令列中的svn版本是1.7.x,而我用的svn客戶端版本是1.8.x,在svn客戶端中使用高版本的操作之後,回到命令列就歇菜了。

一、下載svn新版本

1.1通過brew更新

參見網址:http://subversion.apache.org/packages.html

$ brew options subversion
$ brew install (OPTIONS) subversion
此處更新時使用到Google的庫檔案,下載更新失敗,建議vpn,你懂的。

安裝完成之後:

@caic ➜  bin rvm:(ruby-2.2.1) git:(master) pwd
/usr/local/Cellar/subversion/1.8.13/bin
@caic ➜  bin rvm:(ruby-2.2.1) git:(master) ll svn*
-r-xr-xr-x  1 pingankeji  admin  279216 Oct  9 16:57 svn
-r-xr-xr-x  1 pingankeji  admin   87876 Oct  9 16:57 svnadmin
-r-xr-xr-x  1 pingankeji  admin   47928 Oct  9 16:57 svndumpfilter
-r-xr-xr-x  1 pingankeji  admin   85840 Oct  9 16:57 svnlook
-r-xr-xr-x  1 pingankeji  admin   56812 Oct  9 16:57 svnmucc
-r-xr-xr-x  1 pingankeji  admin   78460 Oct  9 16:57 svnrdump
-r-xr-xr-x  1 pingankeji  admin  100572 Oct  9 16:57 svnserve
-r-xr-xr-x  1 pingankeji  admin   75564 Oct  9 16:57 svnsync
-r-xr-xr-x  1 pingankeji  admin   31116 Oct  9 16:57 svnversion

1.2軟體安裝包更新

從網上下載得到檔案:Subversion-1.8.13_1_*.pkg,安裝步驟跟windows下面差不多,下一步就行了。

這種方式安裝後程序會預設安裝到/opt/subversion下面,設定環境變數時將會不同。

注:參考過http://blog.sina.com.cn/s/blog_a0f3ea980101c0y0.html,裡面要求刪除/usr/bin/svn*等檔案,

再建立軟連結,我這邊獲取root許可權之後還是不行,如果那位搞定了歡迎指導。

二、設定環境變數並啟用

@caic ➜  ~ rvm:(ruby-2.2.1)  vi .bash_profile
將export PATH=/usr/local/Cellar/subversion/1.8.13/bin:$PATH新增到檔案末尾,儲存並退出
@caic ➜  ~ rvm:(ruby-2.2.1)  source .bash_profile
然後在此檢視:
@caic ➜  bin rvm:(ruby-2.2.1) git:(master) svn --version
svn, version 1.8.13 (r1667537)
   compiled Oct  9 2015, 16:56:59 on x86_64-apple-darwin15.0.0

Copyright (C) 2014 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository access (RA) modules are available:

* ra_svn : Module for accessing a repository using the svn network protocol.
  - with Cyrus SASL authentication
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - using serf 1.3.8
  - handles 'http' scheme
  - handles 'https' scheme

三、Xcode自帶客戶端

當前Xcode版本是7.0,SVN客戶端位於“/Applications/Xcode.app/Contents/Developer/usr/bin”目錄下

@caic ➜  bin rvm:(ruby-2.2.1)  pwd
/Applications/Xcode.app/Contents/Developer/usr/bin
@caic ➜  bin rvm:(ruby-2.2.1)  ll svn*
-rwxr-xr-x  1 root  wheel  243680 Sep 11 05:44 svn
-rwxr-xr-x  1 root  wheel   86688 Sep 11 05:44 svnadmin
-rwxr-xr-x  1 root  wheel   56624 Sep 11 05:44 svndumpfilter
-rwxr-xr-x  1 root  wheel   89136 Sep 11 05:44 svnlook
-rwxr-xr-x  1 root  wheel   80864 Sep 11 05:44 svnrdump
-rwxr-xr-x  1 root  wheel   92304 Sep 11 05:44 svnserve
-rwxr-xr-x  1 root  wheel   78080 Sep 11 05:44 svnsync
-rwxr-xr-x  1 root  wheel   36352 Sep 11 05:44 svnversion
接下來我們刪除這些舊版本的SVN程式,如果你不放心,建議備份一下mv svn svn_bak。———對比1.2,此處就不存在許可權不夠的問題了。
@caic ➜  bin rvm:(ruby-2.2.1)  sudo rm -rf /Applications/Xcode.app/Contents/Developer/usr/bin/svn* 
建立連結
@caic ➜  bin rvm:(ruby-2.2.1)  sudo ln -s  /usr/local/Cellar/subversion/1.8.13/bin/svn*  /Applications/Xcode.app/Contents/Developer/usr/bin/ 
當然,如果你想和Xcode一樣,直接把這些檔案複製到Xcode下面也可以
@caic ➜  bin rvm:(ruby-2.2.1)  sudo cp /usr/local/Cellar/subversion/1.8.13/bin/svn* /Applications/Xcode.app/Contents/Developer/usr/bin/ 

參考地址:

http://www.mamicode.com/info-detail-511302.html