views:

451

answers:

7

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 project file for me. However when I commit changes I have to tell to TortoiseSVN that old files was deleted and new files was added what isn't quite true and it breaks history of particular code.

So my question is: When I rename file in Visual Stuido is there any way to tell TortoiseSVN that I did that to prevent 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. May because I found Solution Explorer little clunky. Maybe because I like to think about code editing and revision control as separate steps of software development. I don't know.

+4  A: 

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.

Daniel A. White
But better you switch to this :-)
Andrejs Cainikovs
A: 

maybe you can use ankhsvn plugin for visual studio for svn

or there are plugins like that

ufukgun
+1  A: 

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

Sorantis
+1  A: 

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.

ozczecho
Exactly. First, rename a file so that it has changed name, then replace it with with newer one, then commit. In this case SVN will now that 2 operations had been done.
Andrejs Cainikovs
A: 

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 [...]

Michael Barth
Actually it's done as a copy-and-delete. That way SVN preserves (copies) the history.
sbi
A: 

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.

Nelson Reis
+9  A: 

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.

Jeff Hardy
You saved my history. Thanks a lot.
Jakub Šturc