如何在 Eclipse 中使用外部差异查看器?是否有任何可用于 eclipse 内置的差异查看器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10622518/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 18:11:00  来源:igfitidea点击:

How to use external diff viewers in eclipse? Is there any diff viewer available for eclipse inbuilt?

eclipseeclipse-plugin

提问by kannanrbk

enter image description here

在此处输入图片说明

I am working on a java project in eclipse . Every time commit a file i want to view what are all the changes have done in this file . In eclipse its hard to analyze which lines are removed , added , changed etc . Please give your suggestions on this .

我正在 eclipse 中处理一个 java 项目。每次提交文件时,我都想查看此文件中所做的所有更改。在 Eclipse 中,很难分析哪些行被删除、添加、更改等。请就此提出您的建议。

采纳答案by Mohamed Jameel

actually eclipse have inbuilt compare tool. if u need compare with any other app, try this plugin

实际上 eclipse 有内置的比较工具。如果您需要与任何其他应用程序进行比较,请尝试使用此插件

http://sourceforge.net/projects/externaldiff/

http://sourceforge.net/projects/externaldiff/

回答by E-Riz

You don't say what version control system you're using, but most of them (cvs, svn, git, and perforce, that I know of) implement the Team > Synchronize functionality. The Synchronize perspective provides a preview of both outgoing and incoming changes; you can easily see what has changed that you need to commit side-by-side with what has changed in the repository that you have yet to receive. Right-click a project (or any other selection of version-controlled resources) and select Team> Synchronize. It's virtually identical to what you show from Netbeans.

您没有说明您使用的是什么版本控制系统,但其中大多数(我所知道的 cvs、svn、git 和 perforce)都实现了 Team > Synchronize 功能。Synchronize 透视图提供传出和传入更改的预览;您可以轻松查看需要提交的更改与存储库中尚未收到的更改的内容。右键单击一个项目(或任何其他版本控制资源的选择)并选择Team> Synchronize。它几乎与您从 Netbeans 中显示的相同。

You can also use the Compare Withmenu and/or whatever options are presented by your version control system under the Teammenu for individual files.

您还可以使用“比较”菜单和/或版本控制系统在“团队”菜单下为单个文件提供的任何选项。

The colors in the compare view can be customized to your liking, via Preferences> General> Appearance> Colors and Fonts(look for Text Comparein the tree).

可以根据自己的喜好自定义比较视图中的颜色,方法是通过首选项>常规>外观>颜色和字体(在树中查找文本比较)。

For Mercurial, the MercurialEclipse pluginimplements this Synchronize view.

对于 Mercurial,MercurialEclipse 插件实现了这个同步视图。

回答by fl0w

I landed here because I was looking for a way to merge in an external merge editor (KDIFF3) but start the merge from eclipse. I wasn't satisfied with the answers provided above. So here is ho to configure kdiff3 as merge and diff editor for SVN in eclipse:

我来到这里是因为我正在寻找一种在外部合并编辑器 (KDIFF3) 中合并但从 eclipse 开始合并的方法。我对上面提供的答案并不满意。所以这里是 ho 在 Eclipse 中将 kdiff3 配置为 SVN 的合并和差异编辑器:

go to Windows -> Preferences → Team -> SVN -> Diff ViewerAdd a new config (add button): Extension or mimetype: * - if you wish you can specify different mimetypes for different editors, I didn't need that thus the alquantor.

转到Windows -> Preferences → Team -> SVN -> Diff Viewer添加新配置(添加按钮):扩展或 mimetype:* - 如果您希望可以为不同的编辑器指定不同的 mimetypes,我不需要,因此alquantor。

Diff: Program path C:\Program Files\KDiff3\kdiff3.exe (or wherever you have your merge editor - sry for the windows path, feel free to add a linux version in the comments or edit this answer.)

Diff: 程序路径 C:\Program Files\KDiff3\kdiff3.exe (或者任何你有合并编辑器的地方 - sry 对于 windows 路径,请随意在评论中添加一个 linux 版本或编辑这个答案。)

Arguments: ${base} ${mine} ${theirs}

参数: ${base} ${mine} ${theirs}

Merge: Program path C:\Program Files\KDiff3\kdiff3.exe

合并:程序路径 C:\Program Files\KDiff3\kdiff3.exe

Arguments:

参数:

${base} ${mine} ${theirs} -o ${merged}

This will probably work as well for other merge editors, but with a different argument syntax (figure it out an let us know :) ).

这可能适用于其他合并编辑器,但使用不同的参数语法(弄清楚让我们知道 :))。

The usage is as usual (team->edit conflicts) for merging and compare->foo for the diff view.

合并和 compare->foo 用于差异视图的用法和往常一样(团队->编辑冲突)。

Cheers

干杯

回答by Line

Also, if someone doesn't have to call it indirectly from Eclipse (for example I just don't like to install additional packages such as externaldiff from Mohamed Jameel answer on my Linuxes), you may try call external diff viewer from SVN.

此外,如果有人不必从 Eclipse 间接调用它(例如,我只是不喜欢在我的 Linux 上安装其他软件包,例如来自 Mohamed Jameel 的 externaldiff 答案),您可以尝试从 SVN 调用外部差异查看器。

On Linux this article was very helpful for me: SVN: how to compare working copy with repository revision?.

在 Linux 上,这篇文章对我很有帮助:SVN:如何将工作副本与存储库修订进行比较?.