Subversion 1.7最让我喜欢的一个改变是.svn目录只存在于根目录了。

Lion 的svn还是1.6.17,当时以为Xcode直接调用了/usr/bin/下的svn,于是准备将其升级。subversion.apache.org去下载最新版的subversion-1.7.1.tar.gz

可能需要先安装neon,以免出现“Unable to load revisions”的问题。请到http://www.webdav.org/neon/下载最新版本的neon。解压,安装。

./configure –prefix=/usr/local/neon/

make

sudo make install

ok,接下来就能编译安装svn了。

./configure –prefix=/usr/subversion-1.7.1 –with-apxs=/usr/sbin/apxs –with-apr=/usr/bin/ –with-apr-util=/usr/bin/ –with-ssl –without-berkeley-db –with-neon=/usr/local/neon/

make

sudo make install

我把新版本的svn安装到/usr/下。安装后,输入:svn –version,显示:

svn, version 1.7.1 (r1186859)
   compiled Nov  7 2011, 17:18:47

Copyright (C) 2011 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_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles ‘http’ scheme
* 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

安装后,有2种方式调用新的svn,第一种是在当前用户的目录下,新建一个**.bash_profile**文件,然后在里面输入:

PATH=/usr/subversion-1.7.1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin

这时输入:svn –version,就能看到svn已经是1.7.1了。但是Xcode还是以svn 1.6来checkout项目。我以为Xcode默认使用/usr/bin/下的svn。于是我把/usr/bin/下的7个svn文件备份先,然后

ln -s /usr/subversion-1.7.1/bin/svn* /usr/bin/

发现Xcode还是用svn 1.6来checkout项目。这才发现Xcode自带svn,再来一下吧,仍然需要先备份svn文件,位于**/Developer/usr/bin/**下。

ln -s /usr/subversion-1.7.1/bin/svn* /Developer/usr/bin/

这下ok了。Xcode使用1.7来checkout项目了。

注:如果以前的项目用svn 1.6或更早版本管理,使用“终端”切换到项目当前目录,输入“svn upgrade”来升级至svn 1.7。