# subversion版本控制

SCM的主要任务有两个：第一，变更控制；第二，版本控制。

# 1．Subversion

==================================================

Subversion is developed as a project of the Apache Software Foundation, and as such is part of a rich community of developers and users.

Our Vision

Subversion exists to be universally recognized and adopted as an open-source, centralized version control system characterized by its reliability as a safe haven for valuable data; the simplicity of its model and usage; and its ability to support the needs of a wide variety of users and projects, from individuals to large-scale enterprise operations.

==================================================

Subversion简称SVN，是当前占据主导的版本控制系统，它取代早前流行的CVSConcurrent Version System）。SVN作为新一代的版本控制工具，不仅可以管理程序源代码，也可以应用于其他协作管理数据的工作：例如使用Subversion来合作写乐谱、共同作图。

## 1.1 svn Reference—Subversion Command-Line Client

svn is the official command-line client of Subversion. Its functionality is offered via a collection of task-specific subcommands.

svn子命令集（subcommands）提供了客户端命令行支持，支持的子命令（Available subcommands）包括：checkout (co)、log/status(stat, st)、add/delete (del, remove, rm)、diff (di)/patch、revert、commit (ci)、merge/mergeinfo、resolve/resolved。

## 1.2 svnversion Reference—Subversion Working Copy Version Info

svnversion— Summarize the local revision(s) of a working copy.

svnversion命令用于获取本地工作拷贝（Working Copy）的当前版本号（revision），同“svn info”获取的Revision。

svnadmin： create Subversion repositories and perform several maintenance operations on those repositories.

svnlooksvnlook is a tool for examining the various revisions and transactions (which are revisions in the making) in a repository.

svndumpfiltersvndumpfilter provides a very particular brand of useful functionality—the ability to quickly and easily modify streams of Subversion repositoryhistory data by acting as a path-based filter.

svnrdump：The svnrdump program is essentially just network-aware flavors of the svnadmin dump and svnadmin load subcommands, rolled up into a separate program.

svnsync：The svnsync program provides all the functionality required for maintaining a read-only mirror of a Subversion repository. The program really has one job—to transfer one repository's versioned history into another repository.

## 1.4 svnserve Reference—Custom Subversion Server

svnserveServe Subversion repositories via Subversion's custom network protocol.

svnserve daemon是一个轻量级的服务，使用自定义的协议通过TCP/IP与客户端通讯。客户端通过svn:// 或者svn+ssh:// 开始的URL访问svnserve服务器。

## 1.5 svnmucc Reference—Subversion Multiple URL Command Client

svnmucc— Perform one or more Subversion repository URL-based ACTIONs, committing the result as a (single) new revision.

# 2．Subversion for Windows

## 2.1 TortoiseSVN（Windows）

==================================================

TortoiseSVN is a really easy to use Revision control /version control / source control software for Windows. It is based on Apache Subversion (SVN)®; TortoiseSVN provides a nice and easy user interface for Subversion.

Since it's not an integration for a specific IDE like Visual Studio, Eclipse or others, you can use it with whatever development tools you like, and with any type of file.

==================================================

TortoiseSVN是Subversion版本控制系统的一个免费开源客户端，可以跨越时间管理文件和目录，是当前Windows平台功能最全面、界面最友好的SVN客户端。

TortoiseSVN与Windows 外壳无缝集成(例如资源管理器上下文菜单)，通过用户界面（GUI）收集客户输入，进程名为TortoiseProc.exe。所有的用户输入都通过参数/command:abcd指定给TortoiseProc，其中abcd是必须的命令名。如果你希望使用原生的subversion命令行工具，则可从官方下载Subversion客户端命令行工具包。

## 2.2 VisualSVN（Windows）

==================================================

VisualSVN makes your life easier with a reliable plug-in that integrates Subversion seamlessly with Visual Studio.

==================================================

VisualSVN是一个Visual Studio插件，将Subversion和TortoiseSVN无缝集成到Visual Studio。

## 2.3 SlikSVN（Windows）

==================================================

We provide a standalone command line Subversion package for Windows. The installer contains all command line tools (svn, svnadmin, svnsync, svnserve, svnmucc, etc.) but no application bindings nor Apache modules.

==================================================

# 3．Subversion for Mac OS X

## 3.1 subversion bin utils

### （1）Mac/Xcode的subversion工具包

Mac OS X系统自带Apache Subversion®客户端命令行工具包在终端输入 whereis svn 可查看系统的svn安装在哪里：

~ $whereis svn /usr/bin/svn /usr/bin目录下的svn工具包主要包括：svn、svnversion、svnadmin、svnlook、svndumpfilter、svnsync（不包含svnrdump、svnserve、svnmucc）。 /usr/bin目录下的svn工具包（svn*）实际上是 Xcode Command Line Tools 的 shims or wrapper executables，真正的工具包实体在Xcode.app里面： ~$ xcrun -f svn
/Applications/Xcode.app/Contents/Developer/usr/bin/svn

~ $svn --version svn, version 1.7.20 (r1667490) compiled Aug 17 2015, 15:24:52 Copyright (C) 2014 The Apache Software Foundation. 在~/.subversion/config中配置diff-cmd/diff3-cmd/merge-tool-cmd可指定diff_program/diff3_program/merge_command作为svn diff/merge的第三方（External）工具。 ### （2）安装新版subversion工具包 可从WANdisco Download Subversion Binaries网站页面填写个人信息提交下载申请，然后WANdisco会向邮箱中发送download链接，点击即可下载最新subversion的 pkg 格式安装包。 WANdisco下载的subversion pkg程序默认安装到/opt/subversion目录： ~$ cd /opt/subversion/bin
/opt/subversion/bin $ls svn svnadmin svndumpfilter svnlook svnrdump svnsync svn-tools svnbench svnfsfs svnmucc svnserve svnversion 在Shell Terminal中輸入“export PATH=/opt/subversion/bin:$PATH”命令来追加新装subversion的bin路径到PATH中，但是该方法设置的PATH只对当前Shell窗口有效，新建Shell窗口的svn命令还是指向系统的svn binUtils。

### （3）配置用户环境变量更新svn

~ $cat .bash_profile cat: .bash_profile: No such file or directory 使用touch命令新建.bash_profile文件，使用vi编辑，输入export PATH=/opt/subversion/bin:$PATH，最后使用source命令更新刚配置的环境变量使之加载生效：

~ $touch .bash_profile ~$ vi .bash_profile
~ $cat .bash_profile export PATH=/opt/subversion/bin:$PATH
~ $source .bash_profile 在当前终端窗口或新建终端tab窗口，重新输入svn --version命令，发现svn已经更新到1.9.1： ~$ svn --version
svn, version 1.9.1 (r1698128)
compiled Aug 28 2015, 15:51:18 on x86_64-apple-darwin14.0.0

Copyright (C) 2015 The Apache Software Foundation.

~/path/to/svn_working_copy $svn info svn: E155036: Please see the 'svn upgrade' command svn: E155036: The working copy at '~/path/to/svn_working_copy' is too old (format 29) to work with client version '1.9.1 (r1698128)' (expects format 31). You need to upgrade the working copy first. 执行一下svn upgrade命令，升级当前svn working copy，即可使用最新的svn管理版本控制。 在工程进行upgrade后，重新使用Xcode打开工程，发现Xcode Source Control（可在Xcode Preferences中Enable Source Control）自带的旧版svn已经不能再检测出代码变更。我们需要手动替换Xcode Command Line Tools自带的旧版svn工具包。 ### （4）替换更新Xcode.app的svn 首先cd进入/Applications/Xcode.app/Contents/Developer/usr/bin目录，输入ls svn*命令查看svn工具包： ~$ cd /Applications/Xcode.app/Contents/Developer/usr/bin
/Applications/Xcode.app/Contents/Developer/usr/bin $ls svn* svn svnadmin svndumpfilter svnlook svnrdump svnserve svnsync svnversion 接下来调用sudo mv命令将旧工具包重命名为带.org的备份： /Applications/Xcode.app/Contents/Developer/usr/bin$ sudo mv svn svn.org 

/Applications/Xcode.app/Contents/Developer/usr/bin $sudo ln -s /opt/subversion/bin/svn* ./ 重启Xcode，即可正常Check Remote Repository Status，检测出变更。 说明： 1.除了上面的方法外，也可以直接设置Xcode的XCSubversionToolPath路径： ~$ defaults write com.apple.Xcode XCSubversionToolPath /opt/subversion/bin
2.鉴于/usr/bin目录下的svn工具包（svn*）实际上是 Xcode Command Line Tools 的影子，可省去第3步，安装新版subversion后，直接替换更新Xcode下的对应binUtils即可！

• svnbench
Subversion benchmarking tool.
• svnfsfs
FSFS is the name of a Subversion filesystem implementation, an alternative to the original Berkeley DB-based implementation.
• svnmucc
Subversion multiple URL command client.
• svn-tools
diff，svnauthz，svnraisetreeconflict，x509-parser，…

# 《Xcode自带SVN客户端升级》《升级MacOS X 和 Xcode的SVN到最新版本》

## 3.2 SmartSVN

SmartSVN（Windows| Mac OS X | Linux）

==================================================

The world's most popular, cross-platformgraphical client for Subversion.

SmartSVN is a graphical Subversion (SVN) client that enables developers to work faster and smarter with intuitive features and a user-friendly interface. Developers are able to view the state of a project at a glance with the use of visual indicators rather than a text-based interface, which speeds progress and reduces conflicts.

==================================================

WANdisco SmartSVN功能相当完善，尤其对分支合并支持的很好。

## 3.3 SyncroSVN

Syncro SVN（Windows| Mac OS X | Linux）

==================================================

Syncro SVN Client has been designed to offer powerful actions while keeping the interface as clean and simple as possible. Whether you are new to version control or you are a power user, Syncro SVN Client will give you the best tools to get up and running in no time.

==================================================

SyncroSVN是Mac上功能及用户体验最接近TortoiseSVN的客户端，对分支合并支持良好。

## 3.4 Cornerstone

==================================================

Cornerstone：the ultimate Subversion app.Only for Mac.

==================================================

## 3.5 Versions

==================================================

Versions offers the best way to work with Subversion on the Mac. Thanks to its clear-cut approach, you'll hit the ground running.

==================================================

Versions功能相对完善，UI比较精美，但不支持分支合并。