有没有一个可以理解VB.NET的智能第三合并工具

发布于 2024-08-21 01:58:33 字数 429 浏览 2 评论 0原文

我的合并工具遇到问题,因为有时它无法正确匹配两个分支中未更改的块。当这种情况发生时,合并工具就变得毫无用处,必须手动完成合并。

因此,我正在寻找一种工具:

  • 了解 VB.NET 函数/方法定义的样子,并在匹配块时赋予它们高度重要性。
  • 知道VB.NET会在任何需要的时候改变字段等的大小写,因此在查找公共块时忽略大小写差异,但仍然合并大小写差异。
  • 知道 ' 和 '// 都是注释的开始,并且在找到公共块时会匹配它们

我还忘记了哪些其他要求?

(我们遇到的问题是我们的合并工具(Guiffy 部分) SCM 源代码控制系统)是用 Java 编写的,因此已经通过 Java 进行了良好的测试,并且似乎在“现实生活”中与我们的 C# 代码一起工作得很好,但与我们的 VB.NET 代码相比,它不太适合我们。)

I am having problems with our merge tool as sometimes it fails to match the unchanged blocks in the two branches correctly. When this occurs the merge tool becomes useless, and the merge has to be done by hand.

Therefore I am looking for a tool that:

  • Understand what VB.NET function/method definitions looks like and gives them a high importance when matching blocks.
  • Knows that VB.NET will change the case of fields etc, whenever it feels like it, and therefore ignore differences in cases when finding the common blocks, but still merges the difference in case.
  • Knows that ‘ and ‘// are both start of comments and will match them when finding the common blocks

Also what other requirements have I forgotten?

(The problem we are having is that our merge tool (Guiffy part of SCM source code control system) is written in Java, so has been tested well with Java and seems to work well in “real life” with our C# code, but it does not get on us well with our VB.NET code.)

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

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

发布评论

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

评论(7

指尖上的星空 2024-08-28 01:58:33

回答 Ian Ringrose 的评论
“但是为什么合并工具不能理解给定的语言呢?”

即使 AST 中有源注释的表示,文本格式的源代码与 AST(抽象语法树)代码的概念之间存在不匹配。

您正在寻找的是一个 IDE,它将代码存储为 XML 格式的 AST 表示形式。那么任何面向文本的合并工具都适合您,而不仅仅是 Visual Basic 专用工具。
XML 是一种合并解释源比合并源代码更有意义的格式。

对于区分大小写的语言的一般做法,格式化在代码审查方面是有意义的,重新格式化代码被归类为重构,并且通常必须在版本控制过程中考虑到。
原因之一是,代码格式甚至源文件的编码和回车设置实际上会影响项目,而不仅仅是代码生成的 AST。代码可以在注释中包含元数据,可以由运行时过程进行处理,这甚至可能取决于编码和行结束设置。
例如,ASPNET网站的html输出依赖于字符编码,如果使用不当,输出可能会出现乱码。如果解析器无法处理对 Microsoft 编译器有利的回车符,则处理代码的第三方工具可能会失败。

这就是为什么合并工具主要将每个字符更改视为真正的更改,甚至空格也会产生影响,即使您可以选择忽略它。

Answering the comment by Ian Ringrose
"but why can't a merge tool understand a given language?"

There is a mismatch between the concepts of having source code in text format an having code as an AST (Abstract Syntax Tree), even if there was a representation for source comments in AST.

What you are looking for, is an IDE which would store code as an AST representation in XML format. Then just any text oriented merge tool would work for you, not only a Visual Basic specialized one.
XML is the one format where merging an interpreted source makes more sence then merging the source code.

As for general practices in case sensitive languages, formatting makes sence in terms of code reviewing, reformatting the code is classified as a refactoring, and it generally must be taken into consideration in version control process.
One of the reasons for that, is that code formatting and even encoding and carriage return settings of source files actually affect the project, not only the AST generated from the code. Code could contain metadata in comments, can be processed by a runtime procedure, which could depend even on the encoding and line ending settings.
For example, an ASPNET website html output depends on the character encoding, you output could coume out garbled if you misuse it. A third party tool processing the code could fail, if it's parser can't deal with a carriage return which is considered good for Microsoft compiler.

That is why merge tools mainly treat every character change as a real change, and even whitespace makes difference, even if you have an option to ignore it.

世界等同你 2024-08-28 01:58:33

我目前正在评估的 Araxis Merge 支持“忽略大小写”选项。

Araxis Merge which i'm currently evluating supports Ignore Case option.

水水月牙 2024-08-28 01:58:33

超越比较也许能够满足您的需求。它具有所有主要语言的语法文件,尽管它与大多数其他工具一样是基于行的工具。它在我主要使用的 Java 源代码上完美运行,但您可以为特殊文件类型定义自己的语法文件。您也许可以添加规则来执行您想要进行的特定于应用程序的特殊更改。作为一个交互工具,它与 SVN 的集成是完美的。

我唯一的抱怨是它们不支持 64 位 Linux 或无头 CLI 操作。我很想在没有 GUI 的构建服务器上使用它,但由于这两个问题,这是不可能的。如果有人知道支持语法定义的纯粹基于 CLI 的合并工具,我很想听听。

Beyond Compare may be able to do what you want. It has syntax files for all major languages, though it is a line based tool like most others. It works flawlessly on the Java source I mostly work with, but you can define your own syntax files for special file types. You might be able to add rules to do the special application-specific changes you want to make. Its integration with SVN is flawless as an interactive tool.

My only complaints are that they don't support 64 bit Linux or headless CLI operation. I would love to use this on my build server that does not have a GUI, but it is impossible due to these two issues. If anyone out there knows of a purely-CLI based merge tool that supports syntax definition I would love to hear about it.

你怎么这么可爱啊 2024-08-28 01:58:33

我现在几乎只使用 WinMerge,我发现它比 Tortoise SVN 中的 Merge 更好,而且显然它支持 VB.Net。

我不知道它是否可以理解现场案例等,但它非常强大,所以我值得一试。

WinMerge

I use WinMerge pretty much exclusively now, I find it better than the Merge in Tortoise SVN and apparently it supports VB.Net.

I don't know if it can understand field cases and so on, but it's pretty powerful, so might me worth a try.

WinMerge.

辞别 2024-08-28 01:58:33

合并工具理解文件和文件中的差异,但它们不理解语言和它们之间的差异。

由于大多数语言确实区分大小写变量,这就是大多数合并工具的工作方式。对于 VB.NET 关键字也是如此(If, Then 可以,if, then 不行),所以即使忽略大小写也可能不起作用对你来说很好。

就我个人而言,我使用 perforce 合并工具 (p4merge)。

Merge tools understand files and differences in files, they do not understand languages and the differences between them.

As most languages do make a distinction between upper case and lower case variables, this is how most merge tools will work. This is also true for VB.NET key words (If, Then are OK, if, then are not), so even if it were to ignore case it may not work well for you.

Personally, I use the perforce merge tool (p4merge).

淡淡離愁欲言轉身 2024-08-28 01:58:33

p4merge 非常棒,可以在 perforce.com 上免费获得。

我不知道它是否很好地理解VB.net,但它是一个很棒的工具。

p4merge is pretty awesome, and is available for free at perforce.com.

I don't know if it understands VB.net well, but it is a great tool.

黯然#的苍凉 2024-08-28 01:58:33

我遇到这个问题已经很多年了......

Semanticmerge 已经上市,它声称

基于语言解析(C#、VB.NET、Java)的源代码差异和合并,旨在处理
代码已被移动和修改。

我已经很多年没有使用 VB.NET 了,但我希望 Semanticmerge 能够解决我的问题。

Many years on from me having the problem....

Semanticmerge has hit the market, it claims to

Source code diff and merge based on language parsing (C#, VB.NET, Java), designed to deal
with code that has been moved and modified.

I have not had to use VB.NET for many years, but I expect that Semanticmerge would have solved my problems.

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