Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to revert file but leave it in pending changelist?

Tags:

perforce

p4v

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.

like image 239
Colonel Panic Avatar asked Jun 18 '13 10:06

Colonel Panic


People also ask

How do I get rid of pending Changelist?

To delete a pending changelist, you must first remove all files and jobs associated with it and then issue the p4 change -d changenum command. Related operations include the following: To move files to another changelist, issue the p4 reopen -c changenum command.

How do I revert changes to p4?

Use p4 revert to discard changes made to open files, reverting them to the revisions last synced from the depot (with p4 sync ). This command also removes the reverted files from the pending changelists with which they're associated. An administrator can use the -C option to revert another user's open files.

How do I delete a shelved Changelist?

To delete the Perforce P4 shelved files, use p4 shelve -d followed by the change number: p4 shelve -d -c 7033 Shelved change 7033 deleted. Having removed the shelved files by deleting the shelved change, you can remove the changelist itself: p4 change -d 7033 Change 7033 deleted.


2 Answers

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.

like image 67
Mark Avatar answered Sep 21 '22 10:09

Mark


This is not readily possible, as other respondents noted.

If you are okay with a multi-step solution, you could

  1. Right-click the file in the changelist and choose "diff against have revision".
  2. In the diff window, under "Edit" choose "Edit right/left pane" (whichever side yours is on).
  3. Copy the contents of the original and paste them over your edited workspace version
  4. Save the file.

Your file now has no changes, and it is checked out in the same changelist.

like image 37
the_cat_lady Avatar answered Sep 21 '22 10:09

the_cat_lady