简体   繁体   English

是否有允许例外的文件差异工具?

[英]Is there a file diff tool that allows for exceptions?

We currently use Beyond Compare 3.0 and I am quite pleased with it. 我们目前使用的是Beyond Compare 3.0,我对它非常满意。 However, it would be great if I could easily specify an exclusion for a specific one-time case. 但是,如果我可以轻松地为特定的一次性案例指定排除,那将是很好的。 This is needed when I am doing a code review of some refactoring. 当我对某些重构进行代码审查时,这是必需的。 For instance: 例如:

Old code 旧代码

doSomething(ConstantsInterface.FOOBAR);

New code: 新代码:

doSomething(BetterEnumeration.FOOBAR);

In this case, I have hundreds of changes that I am reviewing that are essentially all the same exact change and I just want to see the exceptions. 在这种情况下,我有几百个我正在审查的更改基本上都是完全相同的更改,我只想查看例外情况。 It would be great if I could easily specify an exception that indicates these two cases are equal. 如果我可以轻松指定一个表明这两种情况相同的异常,那就太好了。 I know of a way to do it in the grammar, but it is tedious and cumbersome in the case where there are ten or so exceptions. 我知道在语法中这样做的方法,但是在有十个左右的例外的情况下,这是繁琐和繁琐的。

Any other tips? 还有其他提示吗?

1) Write one line regex to switch them all back. 1)写一行正则表达式将它们全部切换回来。

2) Diff, see any exceptions 2)差异,见任何例外

3) Run reverse of regex in step 1 3)在步骤1中运行正则表达式的反向

Done in 5 minutes 在5分钟内完成

Beyond Compare's Pro edition supports ignoring renamed identifiers. Beyond Compare的专业版支持忽略重命名的标识符。 It's covered in the help here , and there's a video demonstration of it here . 它涵盖的帮助下在这里 ,而且有它的一个视频演示这里 It's not limited to just identifiers either; 它不仅限于标识符; it can handle things like i=i+1 => i++ . 它可以处理像i=i+1 => i++ If you have a recent version installed you can just right click on the difference and select "Replacement..." to get started. 如果您安装了最新版本,只需右键单击差异并选择“替换...”即可开始使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM