语义差异实用程序 [英] Semantic Diff Utilities

查看:74
本文介绍了语义差异实用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一些语义差异/合并实用程序的很好的例子.比较源代码文件的传统范例是通过比较行和字符来实现的..但是,在比较文件时,是否有实用程序(针对任何语言)实际上考虑了代码的结构?

I'm trying to find some good examples of semantic diff/merge utilities. The traditional paradigm of comparing source code files works by comparing lines and characters.. but are there any utilities out there (for any language) that actually consider the structure of code when comparing files?

例如,现有的diff程序将报告在第125行的字符2处发现的差异.文件x包含v-o-i-d,其中文件y包含b-o-o-l".专用工具应该能够报告方法doSomething()的返回类型从void变为bool".

For example, existing diff programs will report "difference found at character 2 of line 125. File x contains v-o-i-d, where file y contains b-o-o-l". A specialized tool should be able to report "Return type of method doSomething() changed from void to bool".

我认为这种语义信息实际上是用户在比较代码时要寻找的信息,应该是下一代编程工具的目标.可用工具中有此示例吗?

I would argue that this type of semantic information is actually what the user is looking for when comparing code, and should be the goal of next-generation progamming tools. Are there any examples of this in available tools?

推荐答案

我们开发了一种工具,可以精确处理这种情况.检查 http://www.semanticmerge.com

We've developed a tool that is able to precisely deal with this scenario. Check http://www.semanticmerge.com

它基于代码结构合并(和差异),而不使用基于文本的算法,这基本上使您可以处理以下涉及强重构的情况.如下所示,它还能够呈现差异和合并冲突:

It merges (and diffs) based on code structure and not using text-based algorithms, which basically allows you to deal with cases like the following, involving strong refactor. It is also able to render both the differences and the merge conflicts as you can see below:

由于它首先进行解析,所以不会与要移动的文本块混淆,它能够按方法(实际上是按元素)显示冲突.像以前那样的情况甚至没有人为解决的冲突.

And instead of getting confused with the text blocks being moved, since it parses first, it is able to display the conflicts on a per method basis (per element in fact). A case like the previous won't even have manual conflicts to solve.

这是一种可识别语言的合并工具,很高兴终于能够回答这个SO问题:-)

It is a language-aware merge tool and it has been great to be finally able to answer this SO question :-)

这篇关于语义差异实用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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