SVN

概念

生命周期

启动

svnadmin create /opt/svn/rp1 # 创建版本库

配置

# /opt/svn/rp1/conf/authz
[/]
admin = rw
# /opt/svn/rp1/conf/passwd
[users]
admin = admin
# /opt/svn/rp1/conf/svnserver.conf
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz

检出

svn checkout svn://localhost/ --username=admin

提交

svn status # 检查目前版本跟踪文件情况
svn add readme.html # 添加文件到暂存区
svn commit -m "first commit"

冲突解决

当发生冲突时 无法进行commit 必须进行update解决冲突后再次commit

root@my-win:~/svn# svn commit -m "kkk commit"
Sending        readme.html
Transmitting file data .done
Committing transaction...
svn: E160028: Commit failed (details follow):
svn: E160028: File '/readme.html' is out of date
root@my-win:~/svn# svn update
Updating '.':
C    readme.html
Updated to revision 2.
Summary of conflicts:
  Text conflicts: 1
Conflict discovered in file 'readme.html'.
Select: (p) postpone, (df) show diff, (e) edit file, (m) merge,
        (mc) my side of conflict, (tc) their side of conflict,
        (s) show all options: mc
Resolved conflicted state of 'readme.html'
Summary of conflicts:
  Text conflicts: 0 remaining (and 1 already resolved)

版本回退

svn revert readme.html # 回退某一文件

查看

svn log # 输出历史日志信息
svn diff -r 1 readme.html # 输出与版本号为1diff的文件内容
svn cat -r 1 readme.html # 查看某一特定版本的文件内容
svn list svn://localhost/ # 输出版本库文件列表