Recipe 4.6 Comparing Files Against Local History


4.6.1 Problem

You need to see how a file has been changed since the last save.

4.6.2 Solution

Highlight the file in a view, and select Compare With Local History in the view's context menu.

4.6.3 Discussion

Eclipse records changes to a file in its local history. To get an idea of how a file has been changed since it was last saved, highlight the file and right-click it, selecting Compare With Local History. The recent changes appear in the dialog shown in Figure 4-11, graphically displayed.

Figure 4-11. Comparing against local history

You also can check an individual element's recent history (instead of an entire file). Right-click an element and select Local History Compare With to see a graphical display of the recent changes. Eclipse 3.0

Eclipse 3.0 has a built-in Quick Diff bar that enables you to compare lines individually to those stored on disk (the default), as well as to changes in a CVS repository. You can see the Quick Diff bar immediately to the left of the JDT editor in Figure 4-12. To compare a line with the most recent version of the file on disk, rest the mouse cursor over the Quick Diff bar.

Figure 4-12. The Eclipse 3.0 Quick Diff bar

To turn off Quick Diff, right-click the Quick Diff bar and select Disable QuickDiff. To make Quick Diff compare against your code in a CVS repository, right-click the Quick Diff bar and select Set QuickDiff Reference Latest CVS Revision.

4.6.4 See Also

Recipe 4.5 on comparing files; Recipe Restoring Elements and Files from Local History on restoring elements and files from local history.

Eclipse Cookbook
Inside XML (Inside (New Riders))
ISBN: 596007108
EAN: 2147483647
Year: 2006
Pages: 232
Authors: Steve Holzner

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: