Subversion (SVN) 开源的代码版本控制系统(集中式代码管理) ,常用命令有: checkoutupdateadddeletecommit 等。

yum install -y subversion
[root@ec-a ~]# svn --version
svn, version 1.7.14 (r1542130)
   compiled Apr 11 2018, 02:40:28
usage: svn <subcommand> [options] [args]

检出(checkout)

checkout 导出获得文件。导出的文件仍处于SVN版本控制中,与版本库保持关联,你可以进行Svn Update 或者Svn Commit 操作。同时, 在本地建立一个工作区 ,导出文件夹下有一个.svn的隐藏文件夹,存储着一些版本的元数据信息。

Note: 当你要发布或编译的时候,可以采用export ,不引入svn的附加文件。

svn checkout [URL] --username=user
[root@ec-a ~]# mkdir -p /home/e.c.com/repository/svn/

[root@ec-a ~]# cd /home/e.c.com/repository/svn/

[root@ec-a svn]# svn checkout https://10.30.1.130:4430/svn/ylink/trunk/ --username=ec
Error validating server certificate for 'https://10.30.1.130:4430':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
 - The certificate hostname does not match.
Certificate information:
 - Hostname: WIN-2MKIO4EQEDK.xxxx.com
 - Valid: from Wed, 15 May 2013 06:08:12 GMT until Sat, 13 May 2023 06:08:12 GMT
 - Issuer: WIN-2MKIO4EQEDK.xxxx.com
 - Fingerprint: 3e:18:fc:75:71:ba:fd:59:db:cd:c9:c1:11:a5:ca:66:49:29:b7:a1
(R)eject, accept (t)emporarily or accept (p)ermanently? p
Authentication realm: <https://10.30.1.130:4430> VisualSVN Server
Password for 'ec': 

-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <https://10.30.1.130:4430> VisualSVN Server

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes

......
A    trunk/fspsty/src/config/sql/source/activiti-5.12.1/libs/activiti-json-converter-5.12.1-sources.jar
A    trunk/fspsty/src/config/sql/source/activiti-5.12.1/libs/activiti-explorer-5.12.1.jar
A    trunk/fspsty/src/config/sql/source/activiti-5.12.1/libs/activiti-diagram-rest-5.12.1-sources.jar
A    trunk/fspsty/src/config/sql/source/activiti-5.12.1/libs/activiti-cxf-5.12.1-sources.jar
A    trunk/fspsty/src/config/sql/source/activiti-5.12.1/libs/activiti-bpmn-converter-5.12.1.jar
......

Checked out revision 15733.

更新(update )

更新到最新版本 svn update
更新到指定版本 svn update -r 版本号

[root@ec-a trunk]# svn update 
Updating '.':
U    ecps/src/config/struts/product.xml
U    ecps/src/config/struts/prod_regCred.xml
U    ecps/src/config/struts/member_acy_agreement.xml
......
U    ecps/web/pages/product/consumeMaterials/addConsume.jsp
U    ecps/web/pages/product/regCred/list.jsp
U    ecps/web/pages/product/regCredType/list.jsp
Updated to revision 15733.

添加文件(add)

往版本库中添加新的文件。

svn add [filename]
# 例如:
svn add test.java

提交(commit

将改动的文件提交到版本库。

svn commit -m "注释" [-N] [--no-unlock] PATH
# 例如:
# 如果选择了保持锁,就使用 --no-unlock 开关
svn commit -m "test"