能够合并冲突的更改的合并工具

发布于 2024-08-08 20:44:13 字数 517 浏览 4 评论 0原文

我目前正在使用 TortoiseSVN 来合并两个分支,我发现它不够智能,无法处理特定的合并场景。

在一个分支中,我有如下方法:

MyMethod(parameter1, parameter2, parameter3)

在另一个分支中,我有相同的方法,如下:

MyMethod(parameter1, parameter2, parameter4)

TortoiseMerge 注意到存在冲突,但只提供了使用一种方法签名或另一种方法签名的选项。但是,我真正想要的是将其合并为具有所有四个参数的单个方法,如下所示:

MyMethod(parameter1, parameter2, parameter3, parameter4)

目前解决此冲突的唯一方法是解决该行,以便两种方法都存在,然后手动转到并在冲突解决后进行更正。

这就是事情的本质吗?还是有更智能的合并工具能够处理这种情况?

I'm currently using TortoiseSVN to do a merge of two branches and I've found that its not smart enough to handle a specific merging senario.

In one branch I have a method as follows:

MyMethod(parameter1, parameter2, parameter3)

In the other branch I have the same method as follows:

MyMethod(parameter1, parameter2, parameter4)

TortoiseMerge notices that there is a conflict but only gives me the option of using one method signature or the other. However, what I really want is to merge it into a single method with all four parameters as follows:

MyMethod(parameter1, parameter2, parameter3, parameter4)

The only way I can get around this conflict at the moment is to resolve the line so that both methods are present and then manually go to the file and correct it after the conflict has been resolved.

Is this just the way things are or is there a smarter merge tool out there somewhere that would be able to handle this scenario?

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

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

发布评论

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

评论(5

倾城泪 2024-08-15 20:44:13

我不明白?您的项目将无法编译,或者更糟糕的是,合并后将无法正确运行,因为您想要的方法签名不在任何一个分支中。这不是比冲突更危险吗?也许我错过了一些明显的事情。

恕我直言,TortoiseSVN(或者更确切地说是 SVN 客户端)在报告冲突时做了正确的事情,它需要人工干预。

I don't get it? Your project won't compile, or worse, won't run correctly after the merge because the method signature you want is not in either branch. Isn't this more dangerous than a conflict? Perhaps I've missed something obvious.

IMHO TortoiseSVN (or rather the SVN client) is doing the right thing in reporting a conflict, it needs human intervention.

玩套路吗 2024-08-15 20:44:13

Araxis Merge 因其强大的功能而广受欢迎。就我个人而言,我喜欢 SourceGear DiffMerge 因为它更免费。

Araxis Merge is popular for its power. Personally I like SourceGear DiffMerge since its more free'er.

梦晓ヶ微光ヅ倾城 2024-08-15 20:44:13

AFAIK,除了将其报告为冲突之外,没有任何合并工具可以在这些情况下提供帮助

您希望该工具将其合并到具有所有 4 个参数的单个函数调用中。

MyMethod(参数1,参数2,
参数3、参数4)

这里也存在不确定性,是先放置参数 3,然后是参数 4,还是反之亦然。

AFAIK, No merge tool can help in these scenarios except reporting it as conflict

You want the tool to merge it into a single function call with all 4 parameters.

MyMethod(parameter1, parameter2,
parameter3, parameter4)

Here also comes the ambiguity whether to place the parameter3 first and then parameter 4 or the vice-versa.

农村范ル 2024-08-15 20:44:13

到目前为止,我还没有找到任何工具可以自动完成我的要求。这甚至可能是不可能的。但我找到了一个解决方法,我想我应该报告一下。

我最终安装了 perforce Visual merge 我发现它有更好的合并比 tortoise svn 提供的默认设施更方便。我发现的一个很好的功能(我不记得乌龟合并是否有)是它允许人们查看并编辑合并的结果。因此,即使它无法自动合并我想要的行,我也可以就地编辑冲突,而不是错误地解决它并在合并后手动更新它。

So far I haven't found any tool that does what I'm asking for automatically. It may not even be possible. But I have found a workaround which I thought I'd report on.

I ended up installing perforce visual merge which I've found has a nicer merge facility than the default provided by tortoise svn. One of the nice features I've found, which I can't remember if tortoise merge had, is that it allows one to see and edit the merged result. So even though it can't automatically merge the line I want, I am able to edit the conflict in situ instead of resolving it incorrectly and manually updating it after the merge.

铃予 2024-08-15 20:44:13

我确信 TortoiseSVN 无法处理这个问题。更广泛地说,任何其他基于文本的合并/比较工具都不能:请记住,这些工具与您使用的语言无关,它们无法从语义上理解您的代码。他们只是进行“逐个字符”比较,而不像编译器那样实际读取或赋予这些字符所表达的含义。

如果您使用的语言中这种操作在某种程度上是合法的,也许您可​​以检查是否有与该语言相关的内容。

至于边合并边编辑的能力,TortoiseSVN其实是可以做到的。

I'm sure TortoiseSVN can't handle this. More broadly, any other text based merge/diff tool can't: keep in mind that those tools are agnostic of language you're using, they don't understand your code semantically. They just make a "char by char" comparison, without actually reading like a compiler do or giving a meaning to what those chars are expressing.

In case you're using a language in which this kind of operation is somewhat legal, maybe you can check if there's something related to that language.

As for the ability to edit while merging, TortoiseSVN can actually do that.

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