10

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 .

Mohamed Jameel
  • 602
  • 5
  • 21
kannanrbk
  • 6,964
  • 13
  • 53
  • 94

4 Answers4

4

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.

You can also use the Compare With menu and/or whatever options are presented by your version control system under the Team menu 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 Compare in the tree).

For Mercurial, the MercurialEclipse plugin implements this Synchronize view.

E-Riz
  • 31,431
  • 9
  • 97
  • 134
  • And also you can use Team -> Commit and then double click on any file and it will bring up a compare editor that shows the changes. – Francis Upton IV May 16 '12 at 17:00
  • 2
    Hi , I already using eclipse diff viewer . I want diff viewer like netbeans . In eclipse diff viewer hard to analyze which lines are removed , changed , added etc . I am using HG Mercurial . – kannanrbk May 16 '12 at 17:00
  • 1
    Are you using the MercurialEclipse plugin (http://www.javaforge.com/project/HGE)? I edited my answer above with information about it. – E-Riz May 16 '12 at 20:30
  • 4
    The point that is being made is that netbeans has big blue, green and red swathes of colour highlighting the diffs but eclipse mostly has grey and the preferences can't change it to look the same as netbeans (or IDEA or TortoiseDiff etc). If you manage it then please post a screenshot. – opticyclic Dec 07 '12 at 17:20
4

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:

go to Windows -> Preferences → Team -> SVN -> Diff Viewer Add 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.

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.)

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

Merge: Program path 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.

Cheers

fl0w
  • 3,593
  • 30
  • 34
  • How do you do this for Git? Git doesn't expose a Diff option in Eclipse. – gene b. Apr 23 '20 at 14:12
  • @geneb. unfortunately you are correct there, to have git use an external diff viewer there are only workaround solutions I'm afraid. The first thing you need is to configure an external merge tool in git conf (https://stackoverflow.com/questions/161813/). Then you need to create a launch config, that passes your local folder an the files (parameters) to diff to git itself, which then sends them to the merge editor. Like I said, it's really more of a workaround than a solution. That's why i haven't written a tutorial for it yet. – fl0w Apr 24 '20 at 05:46
  • @geneb. see my new git answer below – fl0w Aug 18 '21 at 13:21
2

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

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

Mohamed Jameel
  • 602
  • 5
  • 21
  • 4
    "This plugin doesn't replace the built-in Eclipse tool. It only adds a new menu item to the GUI." :-/ – steffen Oct 29 '14 at 12:42
  • 1
    Sadly this plugin relies upon the files being local, so those in version control cannot be compared. – mrswadge Sep 10 '15 at 08:31
0

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.

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

Community
  • 1
  • 1
Line
  • 1,529
  • 3
  • 18
  • 42