这是我的场景:
假设我们有一个包含以下内容的 SVN 存储库: myfolder myfolder\file.txt
现在我创建了这个 repo 的两个结帐,co1 和 co2。
在 co1 中我们修改 file.txt。在二氧化碳中,我们:
- svn 删除我的文件夹
- svn 提交
- 创建一个名为 myfolder 的新文件夹
- svn 添加我的文件夹
- svn 提交
现在,如果我尝试在 co1 中进行更新,我会遇到树冲突:
A + C myfolder > local edit, incoming delete upon update
M + myfolder\file.txt
我想保留我的文件夹和修改后的文件,所以我解决了树冲突:
svn resolve --accept working folder
现在,如果我尝试提交,我会得到“svn: Directory '/myfolder' is out of date”。如果我尝试使用 svn up myfolder 解决此问题,我会再次遇到树冲突:
A + C folder > local add, incoming add upon update
M + myfolder\file.txt
好的,所以我们再次尝试 svn resolve --accept 工作文件夹。但是我们仍然无法提交,我们得到相同的消息“svn: Directory '/myfolder' is out of date”,如果我们执行 svn up myfolder,我们会回到最后的树冲突。
解决此类冲突的正确程序是什么(当我们希望保留 myfolder 及其更改时)?
编辑:Windows cmd 行脚本来说明:
rmdir /S /Q C:\svntest
mkdir C:\svntest
cd C:\svntest
svnadmin create repo
svn co file:///c:/svntest/repo co1
svn co file:///c:/svntest/repo co2
cd co1
mkdir folder
echo content > folder\file.txt
svn add folder
svn commit folder -m ""
cd C:\svntest\co2
svn up
cd C:\svntest\co1
svn del folder
svn commit -m ""
mkdir folder
svn add folder
svn commit -m ""
cd C:\svntest\co2
echo changed_content > folder\file.txt
svn up
svn resolve --accept working folder
svn commit -m ""
svn up folder
svn resolve --accept working folder
svn commit -m ""
这是运行该脚本的输出(注意最后的提交失败):
C:\>rmdir /S /Q C:\svntest
C:\>mkdir C:\svntest
C:\>cd C:\svntest
C:\svntest>svnadmin create repo
C:\svntest>svn co file:///c:/svntest/repo co1
Checked out revision 0.
C:\svntest>svn co file:///c:/svntest/repo co2
Checked out revision 0.
C:\svntest>cd co1
C:\svntest\co1>mkdir folder
C:\svntest\co1>echo content 1>folder\file.txt
C:\svntest\co1>svn add folder
A folder
A folder\file.txt
C:\svntest\co1>svn commit folder -m ""
Adding folder
Adding folder\file.txt
Transmitting file data .
Committed revision 1.
C:\svntest\co1>cd C:\svntest\co2
C:\svntest\co2>svn up
A folder
A folder\file.txt
Updated to revision 1.
C:\svntest\co2>cd C:\svntest\co1
C:\svntest\co1>svn del folder
D folder\file.txt
D folder
C:\svntest\co1>svn commit -m ""
Deleting folder
Committed revision 2.
C:\svntest\co1>mkdir folder
C:\svntest\co1>svn add folder
A folder
C:\svntest\co1>svn commit -m ""
Adding folder
Committed revision 3.
C:\svntest\co1>cd C:\svntest\co2
C:\svntest\co2>echo changed_content 1>folder\file.txt
C:\svntest\co2>svn up
C folder
At revision 3.
Summary of conflicts:
Tree conflicts: 1
C:\svntest\co2>svn resolve --accept working folder
Resolved conflicted state of 'folder'
C:\svntest\co2>svn commit -m ""
Adding folder
svn: Commit failed (details follow):
svn: Directory '/folder' is out of date
C:\svntest\co2>svn up folder
C folder
At revision 3.
Summary of conflicts:
Tree conflicts: 1
C:\svntest\co2>svn resolve --accept working folder
Resolved conflicted state of 'folder'
C:\svntest\co2>svn commit -m ""
Adding folder
svn: Commit failed (details follow):
svn: Directory '/folder' is out of date