Eclipse Local History & Quick Diff
Join the DZone community and get the full member experience.
Join For Freei worked long hours on my project, and it was working well. but after a series of edits, somehow the application was not working the way it should. what did i change to break my code? usually i smile, because i have things in a version control system. but: not this time (i should know better!). luckily there are some ways to find out what has been changed: with the local history and quick diff .
local history
even if not using a version control system, eclipse has a local history built-in. to compare and diff with the history, i use the menu
this opens the history view which offers compare and merge (see compare and merge in eclipse ):
the number of entries (and size) of the local history is configured in the following workspace setting (menu window > preferences > general > workspace > local history ):
note: keeping a long history might slow down eclipse, especially at workspace closure time (see codewarrior tool tip #3 ). so better not to keep too much of history.
quick diff
the local history is nice, but there is even a faster way: quick diff !
quick diff can be enabled (if not already done) in the workspace settings (menu window > preferences > general > editors > text editors > quick diff ):
in the settings i can change the colors, and as well what to use as reference ((version on disk, latest cvs version or pristine svn copy).
note: there seems to be a problem (oversight?) in eclipse (at least 3.6) with using ‘version on disk’: with saving a file the quick diff markers are gone too
. but it works as expected with the svn settings. another good reason to use svn
.
there is a general option to enable quick diff, and i have enabled as well the ‘show differences in overview ruler’.
what it does: it shows the differences in the left editor area (where usually the line numbers are):
the colors are as configured in the quick diff preferences shown earlier.
if i move the mouse over the marker, a pop-up window shows up:
the first character in the pop up indicates what has changed:
- >: changed line
- +: inserted line
- -: deleted line
note the ‘press ‘f2′ for focus’ : that way i copy and restore my earlier version. quick is simple and fast and gives me an immediate access to the earlier version.
happy quick diffing
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments