SVN 支持历史合并,那么 Mercurial 有何优势?

发布于 2024-09-02 04:07:18 字数 926 浏览 5 评论 0原文

可能的重复:
合并:hg/git 与 svn

你好,

我是 SVN 的长期用户并且已经听到了很多关于一般的善变和去中心化版本控制系统的争论。我知道的主要吹捧功能是 Mercurial 中的合并要容易得多,因为它记录每个合并的信息,因此每个连续的合并都知道以前的合并。

现在正如 红皮书 中所述,在与合并有关的部分中,SVN 已经支持此功能合并信息。现在我还没有真正使用过这个功能(虽然我想使用,但我们的 repo 版本还不够新),但是这个 SVN 功能与 Mercurial 提供的功能有什么特别不同吗?

对于那些不知道 svn 中历史合并的建议工作流程的人来说是这样的:

  1. 从开发主干分支到 做你自己的事情。

  2. 定期合并来自主干的更改 到您的分支以保持最新状态。

  3. 完成后合并回来 mergeinfo 以使过程顺利进行。

如果没有历史数据合并,这将是一场噩梦,因为比较严格地针对文件中的差异,并且没有考虑途中采取的步骤。因此,开发主干中的每次更改都会使您在合并回来时进一步陷入可能的冲突。

现在我想知道的是:

与 SVN 中的 mergeinfo 相比,使用 Mercurial 进行合并是否提供了显着的优势,或者这只是一堆空话?

有人使用过 SVN 中的 mergeinfo 功能吗?它在实践中到底有多好?

Possible Duplicate:
Merging: hg/git vs. svn

Hi,

I'm a long time SVN user and have been hearing a lot of brou ha ha with regard to mercurial and decentralised version control systems in general. The main touted feature that I am aware of is that merging in Mercurial is much easier because it records information for each merge so each successive merge is aware of the previous ones.

Now as stated in the red book, in the section to do with merging, SVN already supports this with mergeinfo. Now I have not actually used this feature (although I wanted to, our repo version wasn't recent enough) but is this SVN feature particularly different to what Mercurial offers?

For anyone who is not aware the suggested work flow for historical merging in svn is this:

  1. branch from the development trunk to
    do your own thing.

  2. Regularly merge changes from trunk
    into your branch to stay up to date.

  3. Merge back when your done with the
    mergeinfo to smooth the process.

Without historical data merging this is a nightmare because the comparison is strictly on the differences in the files and does not take into account the steps taken on the way. So each change in the development trunk puts you further into possible conflict when you merge back.

Now what I would like to know is:

Does merging using Mercurial provide a significant advantage when compared with mergeinfo in SVN or is this just a lot of hot air about nothing?

Has anyone used the mergeinfo feature in SVN and how good is it actually in practice?

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

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

发布评论

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

评论(1

淤浪 2024-09-09 04:07:18

正如评论中提到的,这个 SO 问题几乎概括了它,但值得指出确切的 Subversion(最新的 1.6!)文档,说明合并限制:

    svn merge --reintegrate ^/branches/my-calc-branc

一旦从分支到主干完成了--reintegrate合并,该分支就不再可用于进一步的工作。它无法正确吸收新的主干更改,也无法再次正确地重新集成到主干。

什么?如果自上次合并回主干后您在该分支上做了更多工作,您就不能再进行第二次 --reintegrate 合并?
您必须创建另一个分支或使用 一种精挑细选的语法,还有另一个选项来保持它的活力。

结论告诉您所需的一切知道:

底线是 Subversion 的合并跟踪功能具有极其复杂的内部实现,并且 svn:mergeinfo 属性是用户进入机器的唯一窗口。由于该功能相对较新,因此可能会出现许多边缘情况和可能的意外行为。

例如,有时运行简单的 svn copysvn move 命令时会生成 mergeinfo。

  • 有时合并信息会出现在您不希望被操作触及的文件上。
  • 有时,当您期望时,合并信息根本不会生成。

此外,mergeinfo元数据的管理具有:

  • 围绕它的一整套分类法和行为,例如“显式”与“隐式”合并信息、“有效”与“无效”修订,
  • mergeinfo“省略”的具体机制,
  • 甚至是从父目录到子目录的“继承”。

让我们将其与 DVCS 进行比较:

只需合并即可;)

这并不意味着 SVN 不知道如何合并(对于简单的合并工作流程,它会完成这项工作),但其底层机制的复杂性实际上会限制分支和合并的使用,使得少数合并变得相当微不足道。
相比之下,DVCS中合并操作的便利性会增加分支的使用和合并场景的复杂性,而这些都不再是问题。

As mentioned in the comments, this SO question pretty much sums it up, but it bears pointing out the exact Subversion (1.6 latest!) documentation stating the merge limitation:

    svn merge --reintegrate ^/branches/my-calc-branc

once a --reintegrate merge is done from branch to trunk, the branch is no longer usable for further work. It's not able to correctly absorb new trunk changes, nor can it be properly reintegrated to trunk again.

What? If you did work some more on that branch since the last merge back to trunk, you can no longer make a second --reintegrate merge?
You have to create another branch or use a cherry-picking syntax with yet another option to keep it alive.

The conclusion tells you all you need to know:

The bottom line is that Subversion's merge-tracking feature has an extremely complex internal implementation, and the svn:mergeinfo property is the only window the user has into the machinery. Because the feature is relatively new, a numbers of edge cases and possible unexpected behaviors may pop up.

For example, sometimes mergeinfo will be generated when running a simple svn copy or svn move command.

  • Sometimes mergeinfo will appear on files that you didn't expect to be touched by an operation.
  • Sometimes mergeinfo won't be generated at all, when you expect it to.

Furthermore, the management of mergeinfo metadata has:

  • a whole set of taxonomies and behaviors around it, such as “explicit” versus “implicit” mergeinfo, “operative” versus “inoperative” revisions,
  • specific mechanisms of mergeinfo “elision,”
  • and even “inheritance” from parent to child directories.

Let's compare that to a DVCS:

Just merge already ;)

That doesn't mean SVN doesn't know how to merge (for simple merge workflow, it will do the job), but the complexity of its underlying mechanism will restrain in effect the usage of branches and merges, making the few merge left fairly trivial.
By contrast, the ease of merging operations in DVCS will increase the usage of branches and the complexity of merge scenario, which are no longer a problem.

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