views:

439

answers:

5

If you happen to remove, rename, or delete a file or folder and forgot to use the SVN command to do so in Windows and instead used the file system commands, how do you correct this with TortoiseSVN?

A: 

Did you mean to delete the files?

You can always checkout again, to get the latest svn version, and then do what you need to with the proper svn commands.

sgwill
A: 

If you can undo what you did, then do it (eg move the file back). EDIT: For the case where you are moving files, and you've made changes to those files that, this is (essentially) your only option!

Otherwise you have to do a revert, to revert the changes you've made to the repository, and then use the Tortoise commands.

Just as a note, if you're using Visual Studio, I find Ankhsvn is a really good way to avoid "forgetting" to do it the subversion way -- moving, renaming and deleting all use the svn commands.

Nader Shirazie
thanks. Nadar...what's your view on visualsvn vs. ankhsvn? is one better?
CoffeeAddict
unfortunately I can't answer that question. I really like Tortoise's interface, so I tend to stick to that for most work, and I tend to only use ankh to keep track of changes I make in visual studio. Ankh does have an advantage in price though (its open source and free)
Nader Shirazie
Yea, I don't see what all the hype is about with Visual SVN vs. Free. Visual SVN is cheap!
CoffeeAddict
Sure. 50 bucks for a dev tool is very cheap. I've just never felt the need to try it out. there's a few comparison questions on SO... have a look
Nader Shirazie
+1  A: 

Run svn up from the command line or SVN Update from the windows context menu and it will put back any deleted files. Once the files are back in their respective places, you can delete them from the TortoiseSVN context menu and commit the changes.

Rudisimo
If I understand the OP's question correctly, he wants the files gone, but just didn't tell SVN that by using 'svn delete'.
Nick Meyer
He can follow my advice to update the working copy and then delete the files from the TortoiseSVN context menu.
Rudisimo
if all you want to do is revert your changes and not get any new updates from the repo, then this is actually a bad idea. Nick's instructions on how to revert are the correct method.
Nader Shirazie
+6  A: 

If you deleted a file, but forgot to use the SVN command, then right-click the folder that contained the file and choose "Check for Modifications." In the resulting dialog, the deleted file will show up with status as "missing." There, you can right-click it and choose "delete" for Subversion to understand you want it gone. If you don't want it gone, you can right-click it and choose "revert."

If you renamed, moved, or copied it, then your best bet is to rename/move it back or delete the copy and then use the appropriate Tortoise command correctly. Otherwise you'll lose the history link between the old file and the new file.

Nick Meyer
Thank you.(your best bet is to rename/move it back) So do you mean do this with the file system command or svn command to move it back or rename it back?
CoffeeAddict
file system. Put the file system back the way it was, then use svn to re-apply your changes.
Nader Shirazie
+1 for step by step instructions, and using the "Check for Modifications" dialog (and the correct answer :))
Nader Shirazie
A: 

Until recently, I also used the techniques that Nick mentioned. However, I just stumbled across a much simpler way to tell TortoiseSVN about a file rename.

To tell TortoiseSVN that a file was renamed, right click the folder that contains it and choose Commit... or Check for modifications. You will see the old file name with status "missing" and the new file name with status "unversioned". Use control-click to select those two file names and nothing else, then right click and choose Repair move. Bam! You're done. See the TortoiseSVN web site for all the details.

As Nick said, you can deal with deleted files in those same dialog boxes. Right click on the missing file and either choose Delete to tell TortoiseSVN you really want to delete it, or choose Revert to bring it back.

Don Kirkby