截至目前SVN最新版本已经到l.7.9 Release,而Xcode以及Mac系统自带的SVN版本还是1.6。实在不喜欢SVN1.6版本在每个目录下都生成一个.svn文件夹,所以动手自己来升级SVN。
1、下载最新版的Mac版SVN客户端
到http://www.wandisco.com下载最新的Mac版SVN客户端,地址:http://www.wandisco.com/subversion/download/thankyou?f=subversion-binaries%2F1.7%2FSubversion-1.7.9_10.8.x.pkg 如果你的操作系统不是10.8请自己在下载页面选择一个合适的版本。
下载得到文件:Subversion-1.7.9_10.8.x.pkg。
2、安装最新版SVN客户端
点击刚才下载得到的文件开始安装,程序会安装到/opt/subversion下面。
3、替换Mac OS X自带的SVN客户端
使用如下命令可以找到Mac OS X自带的SVN客户端所在的目录
$ which svn /usr/bin/svn
我们可以看一下这些文件
$ ls /usr/bin/svn* /usr/bin/svn /usr/bin/svndumpfilter /usr/bin/svnrdump /usr/bin/svnsync /usr/bin/svnadmin /usr/bin/svnlook /usr/bin/svnserve /usr/bin/svnversion
接下来我们删除这些旧版本的SVN程序,如果你有点点不放心,建议备份一下。
$ sudo rm -rf /usr/bin/svn*
OK,接下来我们创建一些链接
$ sudo ln -s /opt/subversion/bin/svn* /usr/bin/
好了,我们已经升级成功了,检测一下,如果你看到下面的信息,恭喜你!
$ svn --version svn, version 1.7.9 (r1462340) compiled Apr 3 2013, 13:49:20 Copyright (C) 2013 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 - handles 'https' 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 * ra_serf : Module for accessing a repository via WebDAV protocol using serf. - handles 'http' scheme - handles 'https' scheme
4、替换Xcode自带的SVN客户端
我之前以为Xcode直接调用操作系统自带的SVN客户端,更新了操作系统自带的SVN客户端之后,在Xcode里直接使用SVN,发现竟然还是1.6的!所以我们还需要升级Xcode的SVN客户端。
我当前Xcode版本是4.6.2,SVN客户端位于/Applications/Xcode.app/Contents/Developer/usr/bin/目录下
$ ls /Applications/Xcode.app/Contents/Developer/usr/bin/svn* /Applications/Xcode.app/Contents/Developer/usr/bin/svn /Applications/Xcode.app/Contents/Developer/usr/bin/svnadmin /Applications/Xcode.app/Contents/Developer/usr/bin/svndumpfilter /Applications/Xcode.app/Contents/Developer/usr/bin/svnlook /Applications/Xcode.app/Contents/Developer/usr/bin/svnrdump /Applications/Xcode.app/Contents/Developer/usr/bin/svnserve /Applications/Xcode.app/Contents/Developer/usr/bin/svnsync /Applications/Xcode.app/Contents/Developer/usr/bin/svnversion
接下来我们删除这些旧版本的SVN程序,如果你有点点不放心,建议备份一下。
$ sudo rm -rf /Applications/Xcode.app/Contents/Developer/usr/bin/svn*
老套路,创建链接
$ sudo ln -s /opt/subversion/bin/svn* /Applications/Xcode.app/Contents/Developer/usr/bin/
当然,如果你想和Xcode一样,直接把这些文件复制到Xcode下面也可以
$ sudo cp /opt/subversion/bin/svn* /Applications/Xcode.app/Contents/Developer/usr/bin/
5、升级旧版本检出的代码
如果你使用1.6版本的SVN客户端检出了代码,使用1.7版本的客户端的时候,可能会出一些版本不兼容的问题,解决办法是切入到代码工程所在根目录,执行以下命令进行转换
$ svn upgrade
或者,把之前检出的代码全部删掉,重新检出。。。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。