这篇文章介绍一下团队开发时经常会碰到的svn的冲突产生的原因以及回退或者解决冲突的方式。
冲突产生的原因
多个团队开发成员对同一文件进行了互斥性的修改经常是冲突产生的原因,比如两个开发成员对同一个文件的同一行进行了不同的修改,这种情况就会导致冲突的产生。
模拟冲突
使用如下方式模拟项目中实际的冲突
开发用户 | 分支 | 修改文件 | 修改内容 |
---|---|---|---|
devuser1 | trunk | feature_script.sh | 添加added by devuser1 |
devuser2 | trunk | feature_script.sh | 添加added by devuser2 |
devuser1和devuser2同时checkout
devuser1:
[root@platform trunk]# ls
feature_script.sh trunk-file
[root@platform trunk]#
devuser2:
[root@platform test]# svn co svn://192.168.163.129:3690/demo-repo/trunk --username devuser2 --password devuser2pw
-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:
<svn://192.168.163.129:3690> 4fdba69f-3632-49f7-b5ba-d0491223c588
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/feature_script.sh
A trunk/trunk-file
U trunk
Checked out revision 8.
[root@platform test]# cd trunk/
[root@platform trunk]# ls
feature_script.sh trunk-file
[root@platform trunk]# cat feature_script.sh
[root@platform trunk]#
devuser1进行修改并提交
[root@platform trunk]# ls
fea