1

我在 SVN 中遇到树冲突。有点奇怪!

我有标准的主干、分支、标签结构,并遵循多团队模型。Branch1、Branch2 是从 Trunk 和 active 并行创建的

遵循的步骤:
1 Branch1 Work.:newfile.c添加并提交Branch1
2 Merge.:从 Branch1 -> Trunk(成功;文件添加到 Trunk)
3 Merge.:从 Trunk -> Branch2 向下合并。(成功;在 Branch2 中添加文件)
4. Branch2 Work:执行常规的 Branch2 工作并提交。
5. Merge: 从 Branch2 到 Trunk => 这一步会引发 Tree-conflict fornewfile.c

newfile.cBranch2 团队遇到了他们根本没有接触过的树冲突。为什么会这样。请问有什么建议可以避免吗?这个问题困扰着我很多。

PS:我使用了 TortoiseSVN 客户端 1.6.0 和 TortoiseSVN 1.6.16 - 32 位(分别使用)

合并错误(以上步骤 5):

>svn merge file:///E:/Treeconflict_test/svnRepo/Branches/Br2 Trunk
--- Merging r3 through r8 into 'Trunk':
   C Trunk\src\ARTransactionFeeDto2.java
U    Trunk\pom.xml
 G   Trunk
Summary of conflicts:
  Tree conflicts: 1

>svn status Trunk
 M      Trunk
      C Trunk\src\ARTransactionFeeDto2.java
      >   local obstruction, incoming add upon merge
M       Trunk\pom.xml

PFB svn repo 日志(以上步骤 1-4):

>svn log -v file:///E:/Treeconflict_test/svnRepo
------------------------------------------------------------------------
r8 | rohit | 2013-03-05 16:30:35 +0530 (Tue, 05 Mar 2013) | 1 line
Changed paths:
   M /Branches/Br2/src/ARTransactionFeeDto2.java

br2 branch changes
------------------------------------------------------------------------
r7 | rohit | 2013-03-05 16:29:34 +0530 (Tue, 05 Mar 2013) | 1 line
Changed paths:
   M /Branches/Br2
   M /Branches/Br2/pom.xml
   A /Branches/Br2/src/ARTransactionFeeDto2.java (from /Trunk/src/ARTransactionF
eeDto2.java:6)

dowm-merge from Trunk to branch-Br2
------------------------------------------------------------------------
r6 | rohit | 2013-03-05 16:26:56 +0530 (Tue, 05 Mar 2013) | 1 line
Changed paths:
   M /Branches/Br2/pom.xml

br2 branch changes
------------------------------------------------------------------------
r5 | rohit | 2013-03-05 16:22:26 +0530 (Tue, 05 Mar 2013) | 1 line
Changed paths:
   M /Trunk
   M /Trunk/pom.xml
   A /Trunk/src/ARTransactionFeeDto2.java (from /Branches/Br1/src/ARTransactionFeeDto2.java:4)

up-merge from branch-Br1 to Trunk
------------------------------------------------------------------------
r4 | rohit | 2013-03-05 16:20:48 +0530 (Tue, 05 Mar 2013) | 1 line
Changed paths:
   M /Branches/Br1/pom.xml
   A /Branches/Br1/src/ARTransactionFeeDto2.java

br1 changes
------------------------------------------------------------------------
r3 | rohit | 2013-03-05 16:19:07 +0530 (Tue, 05 Mar 2013) | 1 line
Changed paths:
   A /Branches/Br2 (from /Trunk:2)

created branch br2
------------------------------------------------------------------------
r2 | rohit | 2013-03-05 16:18:57 +0530 (Tue, 05 Mar 2013) | 1 line
Changed paths:
   A /Branches/Br1 (from /Trunk:1)

created branch Br1
------------------------------------------------------------------------
r1 | rohit | 2013-03-05 16:18:13 +0530 (Tue, 05 Mar 2013) | 1 line
Changed paths:
   A /Branches
   A /Tags
   A /Trunk
   A /Trunk/pom.xml
   A /Trunk/src
   A /Trunk/src/ARTransactionFeeDelegateResponse.java
   A /Trunk/src/ARTransactionFeeDto.java
   A /Trunk/src/ResponseARTransFeeDtlsDto.java

initial commit Trunk
------------------------------------------------------------------------
4

3 回答 3

2

在这个工作流程中这是不可能的,即使是 1.6。您必须显示所有命令和输出

根据日志,您是2009 版“Tree Conflict”设计文档中提到的“XFAIL conflict from merge of add over versioned file”的受害者。最重要的部分是

r35341 中的固定期望

而且我不能说,如何将这个修订版翻译成带有错误修复的 TortoiseSVN 版本。我将在我最新的 1.6 ( TortoiseSVN 1.6.16, Build 21511 - 32 Bit , 2011/06/01 19:00:35) 上测试您的工作流程。

我的使用日志TortoiseSVN 1.7.11, Build 23600 - 32 Bit(所有合并 - 基于 GUI 的本地存储库)

>svn log -v file:///Z:/Repo/
------------------------------------------------------------------------
r10 | Badger | 2013-03-05 17:32:32 +0600 (Вт, 05 мар 2013) | 2 lines
Changed paths:
   M /trunk
   M /trunk/Base.txt
   M /trunk/C1.txt
   M /trunk/C2.txt

Merge from branches/b2:

------------------------------------------------------------------------
r9 | Badger | 2013-03-05 17:27:42 +0600 (Вт, 05 мар 2013) | 1 line
Changed paths:
   M /branches/b2/Base.txt
   M /branches/b2/C1.txt
   M /branches/b2/C2.txt

Anfanglichen Deutsch Korperregion
------------------------------------------------------------------------
r8 | Badger | 2013-03-05 17:19:28 +0600 (Вт, 05 мар 2013) | 2 lines
Changed paths:
   M /branches/b2
   M /branches/b2/Base.txt
   M /branches/b2/C1.txt
   M /branches/b2/C2.txt
   A /branches/b2/Reference.txt (from /trunk/Reference.txt:7)

Merge from trunk

------------------------------------------------------------------------
r7 | Badger | 2013-03-05 17:15:29 +0600 (Вт, 05 мар 2013) | 1 line
Changed paths:
   M /trunk
   M /trunk/Base.txt
   A /trunk/Reference.txt (from /branches/b1/Reference.txt:6)

Merge B1 branch changes
------------------------------------------------------------------------
r6 | Badger | 2013-03-05 17:12:26 +0600 (Вт, 05 мар 2013) | 1 line
Changed paths:
   M /branches/b1/Base.txt
   A /branches/b1/Reference.txt

Structure reflected
------------------------------------------------------------------------
r5 | Badger | 2013-03-05 17:09:46 +0600 (Вт, 05 мар 2013) | 1 line
Changed paths:
   M /trunk/C1.txt
   M /trunk/C2.txt

Edition 1
------------------------------------------------------------------------
r4 | Badger | 2013-03-05 17:06:38 +0600 (Вт, 05 мар 2013) | 1 line
Changed paths:
   A /branches/b2 (from /trunk:3)

Branching for task2
------------------------------------------------------------------------
r3 | Badger | 2013-03-05 17:05:49 +0600 (Вт, 05 мар 2013) | 1 line
Changed paths:
   A /branches/b1 (from /trunk:2)

Branching for task1
------------------------------------------------------------------------
r2 | Badger | 2013-03-05 17:03:21 +0600 (Вт, 05 мар 2013) | 1 line
Changed paths:
   A /trunk/Base.txt
   A /trunk/C1.txt
   A /trunk/C2.txt

Basic set
------------------------------------------------------------------------
r1 | Badger | 2013-03-05 16:59:36 +0600 (Вт, 05 мар 2013) | 1 line
Changed paths:
   A /branches
   A /tags
   A /trunk

Imported folder structure
------------------------------------------------------------------------

评论

我试图尽可能准确地重复你的动作

  • r2-r4 - 准备好的测试区域:主干和两个分支
  • r5 - 更改主干以便有分歧的历史
  • r6 - 在分支 b1 (Reference.txt) 中添加了新文件
  • r7 - 合并分支 b1 到主干(Reference.txt 出现在主干中)
  • r8 - 将主干合并到分支 b2(Reference.txt 出现在 b2 中)
  • r9 - b2 中更改的文件,Reference.txt 未更改
  • r10 - 将 b2 合并到主干没有任何错误

添加在

用 1.6.16 测试,得到了描述的结果,即使我在合并树之前已经将分支文件中的编辑预合并到树干中

附加组件 2

妈的!!!它在最新的 1.7 中也不起作用。它让我发疯

于 2013-03-05T11:54:03.447 回答
1

错误消息可能看起来很神秘,但基本上可以解释问题:

局部阻塞,合并时传入添加

您正在将 r3 到 r8 从 BR2 移植到中继中。问题是在 r7 中添加ARTransactionFeeDto2.java

r7 | rohit | 2013-03-05 16:29:34 +0530 (Tue, 05 Mar 2013) | 1 line
Changed paths:
   A /Branches/Br2/src/ARTransactionFeeDto2.java (from /Trunk/src/ARTransactionF
eeDto2.java:6)

...但是由于文件已经存在,因此无法将此类更改移植到主干:

r5 | rohit | 2013-03-05 16:22:26 +0530 (Tue, 05 Mar 2013) | 1 line
Changed paths:
   A /Trunk/src/ARTransactionFeeDto2.java (from /Branches/Br1/src/ARTransactionFeeDto2.java:4)

Subversion 提供了非常复杂的方法来避免它,但我建议您只使用 TortoiseSVN 进行合并,当提示 r7 中的冲突时,您选择保留本地文件(无论如何这与传入文件相同)。

于 2013-03-06T08:23:36.673 回答
0

I attempted to follow these steps (as closely as I could without the actual list of commands available) with SVN 1.7 and it seemed to work as expected for me.

I think that it may not be working for you because of the '--reintegrate' option that you need to use when merging a branch back into trunk. Are you sure that you used this option every time you merged from either branch back to trunk?

If you did use that option, then please disregard this answer.

于 2013-03-27T14:21:27.957 回答