Extend file renaming in VS 2010

317 Views Asked by At

I want to be able to rename classes with associated file in VS without loosing file history in Perforce. I thought I could include an Perforce command (p4 move...) in file renaming of Visual Studio or in class-renaming of ReSharper.

I see 3 options:

Wrap Visual Studio's file-renaming

I extend the file renaming (I mean with file renaming: right-clicking file in Solution Explorer and selecting Rename.) by an own VS add-in or a macro that wraps the existing Rename menu command and calls p4 move....

Extend Visual Studio's file-renaming

I extend the file renaming by any kind of hooking into existing Rename command.

Extend ReSharper's class-renaming

I extend ReSharper's class-rename action (Ctrl+R,R) (with enabled option: Synchronize file names accordingly to changes) by calling p4 move....

Which option is the best one to rename a class with associated file in VS without loosing file history in Perforce?

I have no experience with VS add-ins and ReSharper plug-ins. So if anybody knows that an option is not possible at all than a hint would help me very much.

Any idea?

3

There are 3 best solutions below

0
On BEST ANSWER

You can extend file renaming in VS 2010 by using a macro for adding a "p4 move -k" action to the rename event. See answer of "How to keep change history while renaming files in Visual Studio using Perforce".
This macro calls automatically a p4 rename/move when you do any rename or move action in Visual Studio. So you keep the file history in Perforce.

5
On

Git handles these types of changes pretty well. Could you move to using Git for your development and using Git-P4 to get the source into Perforce? I don't know Perforce so I'm unsure how well this solution works, but it is definitely something to look into.

1
On

Do you have the new P4VS plugin? I believe it supports renaming pretty well.