Search code examples
perforceundo

How do I undo several change lists in Perforce relating to the same files without submitting each one?


I submitted a total of 6 change lists with progressing changes to several files. It was determined that all changes had to be reverted. I had to submit the undo change lists one by one. Now I want to undo the undo, so I can get back to the state I was in to fix the issue. P4V answers me with the following error message when I try to undo the 3'rd change list into the same single change list:

Undo operation cannot be performed
The following files are already checked out
... list of files that are already in the pending change list

How do I get around this? I know I can revert every single file to a specific version, but that is a tedious manual operation.

I am using "Helix Visual Client" version 2020.1/1946989.


Solution

  • You are perhaps trying to undo by clicking on a submitted CL.

    Instead you can click on a p4 depot path, and select undo, this will allow you to undo a range of change lists.

    Step 1: Go to the common ancestors in path which has all the changed files

    Undo range of CL

    The dialog box which opens will allow you to specify a range of CL.

    Step 2: In the undo dialog box select "Undo a range of changes ..." radio button. From the drop down which is now shown select Changelist instead of Revision.

    undo range of CL

    Step 3: Specify the first and last CL in the range to undo (both inclusive).

    This has same effect as Samwise's answer, but via p4v instead of command line.

    More info: https://www.perforce.com/manuals/p4v/Content/P4V/files.undo.html