Reputation: 137752
In Perforce P4V I have a file in a pending changelist. I want to revert the contents of the file but keep the file in the changelist. How can I do that?
I tried Perforce's revert
command but that removes the file from the changelist.
Upvotes: 8
Views: 4426
Reputation: 351
Using the command line, it can be done in three stages. If you are using windows I highly recommend having a unix environment, e.g. cygwin (which is the one I used.)
Assume your changelist number is XYZ and you have shelved the files in their current revision (just for the sake of it!)
Step 1: get a list of files and put them in a temp file.
p4 describe XYZ | grep \/\/ | sed -e 's/\.\.\. //'| sed 's/#.*//' > temp
Step 2: revert all the files in the changelist
p4 revert -c XYZ //...
Step 3: check out / edit the files again
cat temp | xargs p4 edit -c XYZ
I assumed all the files are in edit mode (i.e. not an already opened file or a deleted file).
PS : delete temp, if you are fussy :)
Upvotes: 3
Reputation: 951
This is not readily possible, as other respondents noted.
If you are okay with a multi-step solution, you could
Your file now has no changes, and it is checked out in the same changelist.
Upvotes: 4
Reputation: 3700
The only way to accomplish this (short of copy/pasting the original contents back into this file, but that seems silly) is to revert and reopen it. Shelving, by itself, does not revert the file. The concept of "shelve and revert" is still two operations.
Upvotes: 5
Reputation: 17491
I don't believe this can be done, even from the command line, since p4 sync
(even with -f
) explicitly excludes operations on open files.
Upvotes: 1