[p4] Move/Rename a file that has already been renamed in IDE

P4Sam perforce-user-forum at forums.perforce.com
Wed Jul 10 11:30:02 PDT 2013

Posted on behalf of forum user 'P4Sam'.

"revert -k" and "move -k" will fix it
up.  You'll need to either do this from the command line or write
a custom tool to do it in P4V.  Here's an example:

C:\test\local\client\forum\a>cat finite finite
C:\test\local\client\forum\a>p4 edit finite
//depot/forum/a/finite#1 - opened for edit
C:\test\local\client\forum\a>mv finite infinite
C:\test\local\client\forum\a>echo infinite >
infinite C:\test\local\client\forum\a>p4 add
infinite //depot/forum/a/infinite#1 - opened for add
C:\test\local\client\forum\a>p4 opened
//depot/forum/a/finite#1 - edit default change (text) //depot/forum/a/infinite#1
- add default change (text)
C:\test\local\client\forum\a>p4 revert -k infinite
//depot/forum/a/infinite#none - was add, abandoned
C:\test\local\client\forum\a>p4 move -k finite
infinite //depot/forum/a/infinite#1 - moved from //depot/forum/a/finite#1
C:\test\local\client\forum\a>p4 opened
//depot/forum/a/finite#1 - move/delete default change (text)
//depot/forum/a/infinite#1 - move/add default change (text)
C:\test\local\client\forum\a>cat infinite infinite  
I noticed after running that test that you don't actually need the
"-k" on the revert because reverting an add will "abandon"
it by default, but generally speaking "revert -k" is what you do to
"revert" a file's state as far as the server is concerned while
leaving it intact in your workspace.  Similarly, "move -k"
does the move without performing the corresponding move of the workspace file;
it's there for precisely this situation, where you've already moved the
file and just need to update its open state accordingly in Perforce.

Please click here to see the post in its original format:

More information about the perforce-user mailing list