29
votes

I am using Visual Studio for editing source code and once a while I switch to Windows Explorer to commit changes with TortoiseSVN. This procedure works well for me and I am quite happy with it. However, recently I started to rename classes and reorganize namespaces a lot. I like to rename and move files in Visual Studio because it automatically update the project file for me. When I commit changes, however, I have to tell TortoiseSVN that old files were deleted and new files were added, which isn't quite true and it breaks the history of the particular code.

So my question is: When I rename file in Visual Studio, is there any way to tell TortoiseSVN that I did that to preserve file history?


Update (16:30): Ankhsvn seems to be obvious answer but I like thing as they are now. It sounds weird but I like TortoiseSVN not being integrated in Visual Studio. This is maybe because of my two monitor setup when I have always opened file manager on my secondary monitor. Maybe because I found Solution Explorer a little clunky. Maybe because I like to think about code editing and revision control as separate steps of software development. I don't know.

7
Seems that AnkhSVN is your answer, as almost all answers mention it, including mine :-)Nelson Reis
Jakub, I'm with you on that. I have tried numerous CVS and SVN plugins for VS and always went back to Tortoise.sbi
+1 for great question. Also +1 if I could, for wanting a solution that doesn't require a plug-in. Whilst AnkhSVN is way better than it used to be, it is still no substitute for TSVN. In my experience working without AnkhSVN has been more productive than working with it.Scotty.NET

7 Answers

35
votes

If you have a newer version of TSVN (after 1.5.0, I think), you can use the "repair moves" feature. I use it all the time for situations just like that.

7
votes

Have a look at http://ankhsvn.open.collab.net/. It looks for these things and handles the changes appropriately and shows you directly in the Solution Explorer what has changed. Plus, you don't have to go back to Explorer! I really like it a lot!

There is no reason to prevent file history. That is the whole point of a source code control system.

3
votes

I think AnkhSVN will do the job. It's a free SVN plugin for Visual Studio. There is another one - VisualSVN, but its shareware.

0
votes

maybe you can use ankhsvn plugin for visual studio for svn

or there are plugins like that

0
votes

No. You should do all file moving/renaming in TortoiseSVN (ie file explorer).

There are SVN plugins for Visual Studio that might do what you want.

0
votes

AFAIK, when you use TortoiseSVN to rename your files within the boundaries of source control it deletes and adds the renamed files as new, too.

See here:

Commit the parent folder

Since renames and moves are done as a delete followed by an add [...]

0
votes

I don't know how you can do what you asked, but I think you can solve your problems if you start using AnkhSVN.

It's a great tool that integrates Subversion into Visual Studio and you can do your commits from the VS IDE.