views:

806

answers:

4

I just updated from SVN, and one of my files has now disappeared... of course it wasn't committed because I knew I needed to update+merge first. I think maybe the guy renamed the file which means my SVN client deleted my file.

I'm using VC++ 2008 & Visual SVN.

Help... and for reference how is this kind of thing supposed to be avoided? Aren't you supposed to update before committing?

A: 

SVN should backup the file if you changed it. Check if there is a file which begins with "." and has the revision somewhere in the name in the directory where your changed file is supposed to be.

If that is not the case, check your settings in Visual SVN. Or maybe Visual SVN doesn't do this. Try TortoiseSVN instead.

Aaron Digulla
Tortoise doesn't integrate with VS. Visual SVN uses Tortoise IIRC.
MidnightGun
The new versions of TortoiseSVN put replaced versions of files in the recycle bin (on Windows). I'm not sure which version this started with though...
Garo Yeriazarian
+1  A: 

If you are looking for the file in VS, it is likely that the file still exists in your directory, but is simply no longer referenced in the project (Since VS will only show you files in your project). If the file was renamed, that is likely why you can no longer find it in Visual Studio. I would check the actually directory where the file used to exist.

If it is not there, you can retrieve the old file from the repository by clicking on the containing directory and reverting to a previous revision that contains the file (file deletes are operations on the directory).

Your local copy of the file should not be deleted if there are modifications. This type of thing is annoying, but hopefully doesn't happen very often (how often do you rename files?). Of course, this is also exactly why you should update before committing. In this case, you need to manually merge the changes you made to the old file into the new file and make sure that it all still compiles.

Brian B.
A: 

The answers show you how to restore your file, but more important is your second part of your question: how to avoid such things?

For this you can lock files. This means you want to work undisturbed on this file. SVN will not allow any other user to commit to a locked file. This includes deletion as well.

Peter Parker
A: 

This exactly happened a few weeks ago to me. I was tired when I did "update" instead of "commit". My work was gone, I could recover some of it with Undelete tool.

lubos hasko