Occasionally you need to compare the latest version of code in NWDS with previous versions of it, may be your previous logic was more appropriate or the latest one is having a problem. If you were not using a Source code management system like CVS / Microsoft Visual source safe or your code had not reached a stage where it could have been checked in into it. What would you do in this case? Maintain the various versions of code as separate files on your hard drive???? Well, let NWDS do it for you.
In NWDS, which is based on Eclipse Platform, a local edit history of a file is maintained when a file is created or modified. Each time the file is changed and the changes are saved, a copy of the file is saved with a unique timestamp and with which you can
- Compare your current code
- Replace your current code
- Restore a deleted file
The preferences for local history can be set from the Window –> Preferences –> Workbench –> Local history settings dialogue page. These setting include
- Days to keep files [for how many days the records will be kept]
- Entries per file [number of states to keep]
- Maximum file size (MB) [Size which if exceeded no Local history is maintained]
Note: Local history is maintained only for files. This is how you can replace, compare and restore deleted files
1.Comparison with previous version:
Right click on a source file. Select Compare with –>Local History. This displays a dialogue in which you can select the timestamp of the saved file with which the contents of the current version of file are compared.
2.Replacing the contents with previous version:
Right click on a source file. Select Replace with –> Local history. Similar dialog pops up from where you can compare and then replace the content of current file with one of the previous versions.
Note: There is one more option as Replace with–>Previous from Local History. This will replace your current version with the immediate previous version without showing the differences and confirmation dialog.
3.Restoring deleted resources :
From the pop-up menu of the folder or project into which you want to restore a local history state, select Restore from Local History. A dialog box pops up showing the list of deleted resources and their local history so you have a choice to restore exactly a deleted version or a version prior to that.