在 SVN 中合并一系列修订版与重新集成有什么区别? [英] What are the differences between merging a range of revisions vs. reintegrate in SVN?

查看:23
本文介绍了在 SVN 中合并一系列修订版与重新集成有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了一些关于合并一系列修订和重新集成之间区别的文档和博客,但我没有得到一件事.

I have read some documentation and blogs about the difference between merge a range of revisions and reintegrate but I didn't get one thing.

如果我选择一种或其他方式从分支合并到主干,合并有什么区别?为什么在某些情况下合并一系列修订版不起作用,但重新集成成功地将分支合并到主干?

What is a difference in merging if I choose one or other way for merging from branch to trunk? Why merge a range of revisions doesn't work in some cases but reintegrate successfully merges branch to trunk?

推荐答案

一方面,SVN 计算差异应用的方式在两种方法之间是不同的.通常,例如,当您以挑剔的方式将主干中的一系列修订 X 到 Y 应用到分支时,SVN 会计算主干中 X 到 Y 的修订之间的差异,并将其应用到分支.您也可以在另一个方向上做同样的事情,通过这种方式将更改从分支应用到主干.

For one thing, the way that SVN calculates the differences to apply is different between the two methods. Normally, when you apply a range of revisions X to Y from a trunk to the branch in cherry-picking fashion, for example, SVN calculates the differences between the revisions of X to Y in the trunk, and applies those to the branch. You could also do the same thing in the other direction, applying changes from the branch to trunk this way.

然而,当您将分支重新集成到主干中时,SVN 会进行不同类型的计算.SVN 不是计算分支中修订 X 到 Y 之间的差异并将这些更改应用于主干,而是计算整个分支和主干之间的差异.假设您一直在努力使分支与主干中所做的更改保持同步,那么主干和分支之间重新集成计算的差异将恰好是在分支中所做的所有尚未更改的更改在后备箱里.

When you reintegrate a branch into the trunk, however, SVN does a different sort of calculation. Instead of calculating the difference between revisions X to Y in a branch and applying those changes to the trunk, SVN merely calculates the difference between the entire branch and trunk. Assuming that you've been diligent about keeping the branch up-to-date with changes made in the trunk, then the difference of the reintegration calculation between the trunk and branch will be exactly all of the changes made in the branch that are not yet in the trunk.

来自 SVN 1.6 文档(重新整合一个分支):

From the SVN 1.6 documentation (Reintegrating a Branch):

当你的分支合并回主干,但是,底层数学完全不同.您的功能分支现在是一个大杂烩重复的主干更改和私人分支发生变化,所以没有简单连续的修订范围复制过来.通过指定--reintegrate 选项,你在问Subversion 仔细复制您的分支独有的那些更改.(事实上​​,它是通过比较最新的树干树最新的分支树:结果不同之处正是你的分支变化!)

When merging your branch back to the trunk, however, the underlying mathematics is quite different. Your feature branch is now a mishmash of both duplicated trunk changes and private branch changes, so there's no simple contiguous range of revisions to copy over. By specifying the --reintegrate option, you're asking Subversion to carefully replicate only those changes unique to your branch. (And in fact, it does this by comparing the latest trunk tree with the latest branch tree: the resulting difference is exactly your branch changes!)

我不完全确定(多年来我已经忘记了),但我认为在以前版本的 SVN(比如 1.5 之前?),没有合并跟踪和分支重新集成选项,所以如果你想要将已完成的分支合并到主干中,您必须使用修订范围方法手动完成.我正在尝试在文档中查找此内容,但我还没有找到有关它的参考.

I'm not entirely sure (I've forgotten over the years), but I think in previous versions of SVN (like prior to 1.5?), there was no merge-tracking and no branch reintegration option, so if you wanted to merge a completed branch into the trunk, you had to do it manually using the range of revisions method instead. I'm trying to look this up in the docs, but I haven't found a reference about it yet.

另见 Re:为什么 --reintegrate 需要 svn 1.5 合并吗?,在 此评论.

See also Re: Why is --reintegrate needed for svn 1.5 merging?, which was pointed out in this comment.

这篇关于在 SVN 中合并一系列修订版与重新集成有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆