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 = noneauth-access = writepassword-db = passwdauthz-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.htmlTransmitting file data .doneCommitting transaction...svn: E160028: Commit failed (details follow):svn: E160028: File '/readme.html' is out of dateroot@my-win:~/svn# svn updateUpdating '.':C    readme.htmlUpdated to revision 2.Summary of conflicts:  Text conflicts: 1Conflict 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: mcResolved 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/ # 输出版本库文件列表