I know there are already several questions about renaming files by using a version control system. But I did not found a satisfactory answer to the special version control s
You can save yourself a step in that process by setting up an external tool in VS (Tools->External Tools) to open perforce to the document you have open. Not ideal, but closer to what you want.
Command: p4v.exe
Arguments: -s $(ItemPath)
Initial Directory: $(ItemDir)
The Visual Studio Plugin provides excellent integration with the Visual Studio. All renaming operations work well and the history is tracked ok.
There's a new Visual Studio plugin for Perforce that will be out in beta shortly. It does have support for the built-in Visual Studio rename operation, and also works well with Resharper.
Until it's out I'm afraid the existing solutions are a bit clunky.
I have a good solution now. Just handle macro event SolutionItemsEvents_ItemRenamed.
This is done by open Macros IDE by clicking Tools->Macros->Macros IDE. Then add following event handler to your macro project:
Private Sub SolutionItemsEvents_ItemRenamed(ByVal ProjectItem As EnvDTE.ProjectItem,
ByVal OldName As String)
Handles SolutionItemsEvents.ItemRenamed
Dim process As System.Diagnostics.Process
process.Start("p4", "move -k " & ProjectItem.Properties.Parent.Document.Path &
"\\" & OldName & " " & ProjectItem.Document.Path)
End Sub
See screenshot:
As you can see it just calls a "p4 move -k". "-k" option is needed because after a rename the old file is already deleted, so Perforce would throw an error without "-k". "-k" causes Perforce to rename the file on server only.
If you get Perforce connection errors you need to add a P4CONFIG file where connection is defined. This is done by:
Add file p4config.txt to the directory of your project (or any of its parent directories) with content:
P4CLIENT=your workspace
P4USER=user
P4PORT=p4server:1234
Set environment variable P4CONFIG=p4config.txt
Now you can change your files by any way (Solution Explorer Item->Rename, Solution Explorer Item->F2, ReSharper's Rename file to match type name, ReSharper's class Rename (Ctrl+R,R),...).
But keep in mind: I have problems if I try to edit and rename same file in one chek-in and if I rename a file while another person has checked-out same file.