tags:

views:

65

answers:

4

Every time I rename a file in Perforce it actually deletes an old file and adds a new one. As a result the new file doesn't share the old's file history. Is there an easy way doing it?

+6  A: 

Are you using P4V? It doesn't really delete and add it, it will branch it and then delete the old file (you will see that the new file shows up with the #branch action). That way, the new file will retain the history. It's sometimes not immediately visible, but if you choose to "show branching history", you will see the full history of the file, including everything that happened prior to its renaming.

EboMike
thanks for the reply. Does it matter if I rename a file in P4V, P4Win or just directly in IDE (like Visual Studio). I also can't find "show branching history".
Boris Lipschitz
Both P4V and P4Win rename the file correctly (i.e. delete and branch). I never used the VS IDE, it sucked. Which Perforce are you using (P4V, P4Win), and which version? If I remember correctly, there's a checkbox somewhere in the revision history that allows you to toggle the branching history on and off.
EboMike
I use P4Win Version 2007.2 131755 and P4V /NTX86/2010.1/251161
Boris Lipschitz
In P4V, you see three icons on the top right if you go to the history of a file. One of them looks like a junction with a clock (i.e. "branch history"). If you click on it, you have a choice between "Disabled", "Follow Branch Actions", and more. Choose Follow Branch Actions, and you'll see the full history. P4Win has something similar in form of a checkbox somewhere.
EboMike
+1  A: 

If you are using a recent enough version of Perforce (server and client), you can use the move command to rename a file while maintaining the history more like what you expect. However, as EboMike said, as long as the integration was done, the history is there... it is just slightly less accessible.

Caleb Huitt - cjhuitt
+1  A: 

If viewing the history in p4v, there should be an icon at the tab of the History tab that gives you the option to "Follow Branch Actions" or "Follow Both Branch and Copy Actions".

On the command line type

p4 filelog -i file

The '-i' flag will display the integration history as well.

Chance
A: 

Try using the Revision Graph option for a file, it looks a bit scary to start with but switch off the branches your not interested in and it can be really useful for tracking changes to files across integrations / branches

Toby Allen