SVN - 无法将分支合并回主干 - 许多树冲突

发布于 2024-07-25 00:35:42 字数 654 浏览 3 评论 0原文

我有一个我认为简单的场景 - 使用 TortoiseSVN:

1)我创建了一个应用程序的分支(B2)(用于实现图像精灵和 JAWR)。

2)测试与测试 树干上的发育正常进行。

3)在过去的几天里,我通过以下方式多次重新建立分支:

3.1)将主干(按修订范围)合并到我的branch-b2工作副本,解决合并期间的冲突。

3.2)(在测试branch-b2之后),我提交了重新基于的branch-b2。

这一切都如我所料。 但是将分支合并回主干对我来说很顺利:

4)在branch-b2中提交了所有更新之后; 我确保在 trunk 和branch-b2 上执行 SVN 更新。

5)然后,我尝试将(修订范围)从branch-b2合并到主干中。 然而,对于任何已添加到主干并随后在重新设置基础时添加到分支 b2 的新文件,我会遇到树冲突。 我不确定解决这些冲突的正确方法是什么。

我见过的最典型的建议是要么从主干中删除树冲突文件,然后合并分支;要么从主干中删除树冲突文件,然后合并分支; 或者删除整个主干,复制分支文件,然后将它们作为新版本提交到主干中。 这两个选项似乎都不是一个好主意——第一个选项很痛苦,而且两个选项似乎都会丢失文件修订历史记录。

我做错了什么,我该如何解决?

I have what I thought was a simple scenario - using TortoiseSVN:

1) I made a branch (B2) of an application (to work on implementing image sprites & JAWR).

2) Testing & development went on as normal on the trunk.

3) I re-based the branch a couple of times over the last few days by:

3.1) Merged trunk (by range of revisions) to my branch-b2 working copy, resolving conflicts during the merge.

3.2) (after testing branch-b2), I commit the re-based branch-b2.

This all worked as I expected. But merging the branch back into the trunk is having its way with me:

4) After all updates committed in branch-b2; I make sure I do an SVN Update on trunk and branch-b2.

5) Then, I try to merge (range of revisions) from branch-b2 into the trunk. However, for any new file that had been added to the trunk, and subsequently added to branch-b2 when I rebased it, I get a tree-conflict. I'm not sure what the proper way is to resolve these conflicts.

The most typical advice I've seen is to either delete the tree-conflict files from the trunk, then merge the branch over; or delete the entire trunk, copy the branch files over, and then commit them as a new version in the trunk. Neither of those options seems like a good idea- first one is a pain, and both seem like they would lose file revision histories.

What'd I do wrong, and how do I fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

何以笙箫默 2024-08-01 00:35:42

听起来您正在使用 1.5 之前的合并样式并尝试将分支重新集成到主干中。 在这种情况下,您要做的就是首先确保所有主干更改都已合并到分支中,然后不要将分支范围合并到指向主干的工作副本,而是要合并“FROM trunk” @HEAD TO Branch@HEAD”,工作副本指向主干。 本质上:

“给我所有需要的更改,使主干与分支相同”。

如果您已经将所有主干更改合并到分支,则此方法有效,因为主干和分支之间的唯一区别是在分支中所做的更改。

合理? :)

Sounds like you're using the pre-1.5 merge style and trying to reintegrate the branch into trunk. In that case, what you want to do is first ensure all the trunk changes have been merged in to the branch, and then instead of range-merging the branch to a working copy that points to the trunk, you want to merge "FROM trunk@HEAD TO branch@HEAD" with the working copy pointing to trunk. In essence:

"Give me all the changes I'd need to make trunk identical to branch".

This works if you've already merged all the trunk changes to the branch, because then the only difference between trunk and branch are the changes made in the branch.

Make sense? :)

泪意 2024-08-01 00:35:42

我调查了同样的问题。
这是Tortoise SVN 1.6.5 中的“功能”。
TortoiseSVN 1.5 与我们的存储库 (SVN 1.5) 配合良好。
TortoiseSVN 1.6.5 在变基时将主线中的文件添加为新文件(不保存合并历史记录)。
重新集成分支会导致将这些文件视为与主线冲突。

我通过使用TortoiseSVN 1.6“重新集成分支”的功能解决了这个问题。 它专门用于功能分支。

--
阿列克谢·科尔孙

I investigated the same problem.
It is "feature" in Tortoise SVN 1.6.5.
TortoiseSVN 1.5 works fine with our repositoty (SVN 1.5).
TortoiseSVN 1.6.5 when rebasing adds files from mainline as NEW (without saving merge-history).
And reintegrating branch resuls in treating those files as conflicting with mainline.

I solved the problem by using feature of TortoiseSVN 1.6 "reintegrate branch". It's specifically purposed for feature-branches.

--
Alexey Korsun

囍孤女 2024-08-01 00:35:42

这里有一些更多的信息可以为@Rytmis 的答案做出贡献,帮助我理清思路。

使主干与分支或标签完全相同的高级步骤:

  1. 从主干检出。
  2. 使用主干的工作副本,从主干合并到分支/标签。
  3. 犯罪。

'svn' 命令行命令示例:

svn checkout <trunk url>
cd trunk
svn merge <trunk url> <branch/tag url>
svn commit -m "<message>"

Here's a little more info to contribute to @Rytmis answer that helps me keep this straight.

High-level steps of making the trunk exactly like a branch or tag:

  1. Checkout from the trunk.
  2. Using working copy of trunk, merge from trunk to branch/tag.
  3. Commit.

Example 'svn' command line commands:

svn checkout <trunk url>
cd trunk
svn merge <trunk url> <branch/tag url>
svn commit -m "<message>"
梦里°也失望 2024-08-01 00:35:42

我无法真正弄清楚上述解决方案是如何工作的,所以我的解决方法是不同的。 首先,我确保分支包含主干的所有更改。

1)我得到了一份新的行李箱副本。 2)我使用tortoise svn导出将分支导出到临时位置。 3)我使用Windows资源管理器将整个分支树复制到主干并覆盖所有文件4)我在乌龟上使用了检查更改命令并包含所有未修订的文件复选框。 5)我选择了所有文件并单击“添加”。

您应该使用尚未构建的解决方案,以便未修订的文件不包含输出。

我等不及升级到 1.5+

I could not really figure out how the above solution was to work so my work around is different. First I made sure the branch contained all the changes from the trunk.

1)I got a fresh copy of the trunk. 2)I exported the branch to a temporary location using the tortoise svn export. 3)I used windows explorer to copy the entire branch tree over to the trunk and overwrote all files 4)I used the check for changes command on tortoise and included all unrevisioned files checkbox. 5)I selected all the files and clicked add.

You should use solutions that have not been built so the unrevisioned files do not include output.

I cant wait until we upgrade to 1.5+

热血少△年 2024-08-01 00:35:42

使用 TortoiseSVN 选择“合并一系列版本”选项时选择要合并的版本。 这将防止每次合并操作再次出现相同文件的树冲突。

Select revisions to Merge while selecting "Merge a range of rivisions" option using TortoiseSVN. This will prevent tree conflicts for same files coming again for each merge operation.

瑕疵 2024-08-01 00:35:42

我想我解决了这个问题。
1. 右键单击​​您合并的“分支”。
2.点击乌龟SVN>> 合并
3.“合并一系列修订”和下一步
4.!!!检查“反向合并”!!!
、从“分支”合并的 URL、特定范围“最近合并的修订版”和下一个
5. 下一步
6. SVN Commite

之后我可以从分支合并到主干。

I think I solved that problem.
1. Right click "branch" which you merged.
2. Click Tortoise SVN >> Merge
3. "Merge a range of revisions" and Next
4. !!!CHECK "Reverse Merge"!!!
, URL to Merge from "branch", specific range "recently merged revision", and Next
5. Next
6. SVN Commite

After that I can merge from branch into trunk.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文