views:

234

answers:

4

The problem with renaming files is that if you want to take advantage of Visual Studio refactoring, you really need to do it from inside Visual Studio.

But most (not all*) version control system also want to be the ones doing the renaming.

One solution is to use integrated source control, but this is not always available, and in some cases is pretty clunky.

I'd personally be more comfortable using source control separately, outside of Visual Studio, but I'm not sure how to manage this question of file renames.

So, for those of you that use Visual Studio, which source control do you use? Do you use a VS integration (which one?) and otherwise, how do you resolve this renaming problem?

(* git is smart enough to work it out for itself)

+1  A: 

We use SVN (TortoiseSVN to be exact), and i am always bothered with the renaming problem. The simplest solution i've found is to remove the files from the project, rename them via TSVN and add them back to the project. You have to manually update includes for renamed header files, but this is relatively easy using find&replace.

erelender
Removing file from projects will delete it from this disk. So you need to *exclude* it from the project. I do next: first rename class using menu Refactor in VS, then rename file using SVN and after that - add new file to project and remove old one
abatishchev
Yuck! Sounds horrible either way, though I think that @abatishchev's solution sounds slightly better.
Benjol
If you right click on a file and select "Remove", VS asks if you want to remove or delete the file. If you select remove, the file does not get deleted.
erelender
+1  A: 

We use Team Foundation Server, and it works with no problems. I've also found that moving to using a fully integrated client has improved my workflow, as I don't need to flip between applications just to do trivial tasks.

Rowland Shaw
Thanks. I guess TFS working with VS is a no-brainer :) I dropped TFS from my 'potentials' list a few years back because of price and installation pain. Maybe I should check again...
Benjol
@Benjol check next Monday when VS2010 is released - my understanding is that you get TFS with it.
Rowland Shaw
+2  A: 

mercurial usually prefers to do the renaming via hg rename however it can also detect renames from an outside source by using hg addremove -s 100 (or less than 100 if you want to match a rename with alterations) so clearly you can let VS do the rename and get mercurial to catchup with addremove.

jk
Thanks, that's good to know
Benjol
+5  A: 

I use SVN (TortiseSVN as the client) and use the Repair Move command from the commit dialog heavily. This allows me to rename the files within VS and resolve the rename when I'm ready to commit to keep version history.

As far as using the VS integration, like you, I find all VS integration clunky and do not use it.

Aaron Carlson
Especially as VS integration (at least the last time I used it), is checkout-modify-checkin oriented, and increasingly source control tools are get-modify-merge.
Benjol
Wow, that's great to know. I usually have to do the more complicated: remove from project, svn rename, add back to project shuffle. That means one less step - I'll just have to wait for better VS Integration.
quamrana