dublintech
dublintech

Reputation: 17785

Eclipse local file history

In eclipse, you can right click in a file and then select Team / Show local history. This shows your local saves and is pretty useful.

Now, I made some changes to a file. I am 100% certain I made them. But they have disappeared. Overwritten by someone else I guess. But when I check my local history I can't see my file changes.

My question is:

Does Eclipse always update the local file history for every save? How reliable is it?

Note: I appreciate people are thinking how can someone else overwrite your files. I am working in a force.com project. When you make changes to a file they are push to a central server. There is source control per se. It is like everyone working with a shared folder.

Upvotes: 2

Views: 6861

Answers (2)

randal4
randal4

Reputation: 590

If anyone else runs into this issue, check to make sure you didn't accidentally edit a file in a build or target directory. For instance if you are working on a jsp page and make edits, swear you changed it but they are no longer there in the editor or the local history when you open the file, check to make sure you weren't editing the built version by accident.

This sometimes happens if you are quick to use ctrl-shift-R shortcut to open resources. To avoid this, you can set your build or target folder to derived by right clicking on the folder and checking the derived checkbox. This will prevent the resource from showing in the Open Resource view which could save you headaches later.

To get the code back, I opened the target version and used undo to get to the edited version.

Upvotes: 0

Bananeweizen
Bananeweizen

Reputation: 22070

It depends. Each Eclipse plugin dealing with workspace artifacts can optionally set a flag for local history in its API calls to the workspace resource management when deleting or changing files. If the flag is set, changed files surely get copied into local history. But every plugin can set this flag different.

So even if you might have an editor plugin which always uses local history when saving the edited file, another plugin might delete/modify the file without using local history and therefore interfere.

Summary: Local history is not a reliable way to go back to previously saved versions of a file.

Upvotes: 2

Related Questions