三路合并-不同的哲学? [英] Three-way-merge - different philosophies?

查看:94
本文介绍了三路合并-不同的哲学?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从它问世以来,我一直是 UltraCompare Pro 的用户,并且我认为这是一个功能非常齐全的比较和合并工具.但是,由于我一直在仔细研究DVCS,因此我发现它与其他工具相比,对三向合并的处理方式有所不同.所以我想知道为什么会这样,以及我是否因此而错过了某些东西.

在UltraCompare中,有三个合并面板(我们称它们为基本面板,本地面板和其他面板).所有合并操作都在这些面板中发生.在实践中,这意味着我在中间窗格(本地)上进行工作,合并来自右侧(其他)或来自左侧共同祖先(基础)的更改.中间窗格在会话期间进行修改,然后保存-并作为合并结果提交.第四窗格(输出"窗口)仅包含有关差异结果的信息.


(来源: ultraedit.com )

在其他工具中,似乎三个窗格仅以只读状态存在,而第四个底部窗格(输出)是所有合并发生的地方.有一个额外的合并窗口的原因是什么?跟踪所有更改是否更容易?还是仅仅是因为每个人都一直以这种方式这样做,所以我们正在复制这种行为?您对此有何看法?


(来源: hginit.com )

我不确定是否存在最佳答案或正确答案,因此我还没有对此问题进行CW,但是我也会在这里听取您的意见.

解决方案

对我来说似乎很简单,您可能很想在进行更改时保持未更改的本地"版本可见.

original       local         other           merged

               bar= foo+1    bar= foo+2      bof= foo+2
                                             zot= foo+1
...            ...           ...             ...
print foo      print bar     print foo+1     print bar??

localother都引入了新变量bar.合并对bof/zot的第一个更改,喝杯茶,然后返回并尝试合并print.等一下,local中的bar是什么?如果原始的local不存在,那么该信息就不存在了,而您正与另一个文本编辑器争先恐后地了解发生了什么情况.

这是一个人为的示例,但是对于任何您无法完全掌握并一次性完成的更改,这种事情很容易发生.通常,3WM始终具有两个变量元素,即更改A和更改B.要重现其中的所有信息,您需要四个视图来查看以下所有可能的排列:0(原始),AAB(合并).

I've been a user of UltraCompare Pro since it first came out, and I think it's a very full-featured compare and merge tool. However, since I have been looking more closely into DVCS, I found that it handles three-way merges differently than (most?) other tools out there. So I wonder why that is, and whether I'm missing something because of it.

In UltraCompare, there are three merge panels (let's call them base, local and other). All the merge action happens within these panels. In practice, this means that I do my work on the middle pane (local), merging changes from the right (other) or maybe from the common ancestor on the left (base). The middle pane is modified during the session and then saved - and committed as the result of the merge. The fourth pane (Output window) only contains information about the diff result.


(source: ultraedit.com)

In other tools, it appears that the three panes only exist in a read-only state, and that the fourth, bottom pane (output) is the place where all the merging happens. What are the reasons to have an extra merge window? Is it easier to keep track of all the changes? Or is it just like that because everybody has always been doing it this way, so we're copying that behavior? What's your opinion on this?


(source: hginit.com)

I'm not sure whether there exists a best or correct answer, so I haven't yet made this question CW, but I'll defer to your opinion here as well.

解决方案

Seems straightforward to me, you might very well want to keep an unchanged ‘local’ version visible when you are making your changes.

original       local         other           merged

               bar= foo+1    bar= foo+2      bof= foo+2
                                             zot= foo+1
...            ...           ...             ...
print foo      print bar     print foo+1     print bar??

Both local and other have introduced a new variable bar. Merge the first change to bof/zot, go for a cup of tea, come back and try to merge the print. Wait, what was bar in local? If the original local isn't there, that information's gone, and you're scrabbling about with another text editor to work out what's happened.

This is a contrived example but this sort of thing can easily happen for any set of changes you can't keep all in your head and do in one go. In general, a 3WM always has two variable elements, change A and change B. To reproduce all the information in that, you need four views for all the possible permutations of: 0 (the original), A, B, and AB (the merge).

这篇关于三路合并-不同的哲学?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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