Undoing changes
With Helix server 2017.1 and later, you can undo:
- A single change made at a given changelist or revision while keeping subsequent changes.
- A range of changes made at a given range of changelists or dates, or at a given label (of which you are the owner), while keeping subsequent changes.
-
All changes from a selected changelist, date, or label to the most recent version. The submitted files become the new head revision in the depot.
Helix server does not undo integration records with p4 undo
. When P4V undoes a merge event, it does undo the change but does not undo any integration history.
The Undo Changes dialog always opens in the context of the selected entity, which can be a workspace or depot folder or file, a changelist, a revision, or a label. For example:
- If you open the dialog from a changelist, you can browse to a subfolder to narrow down the operation to files in a subfolder. The folder you select must match the selected changelist.
- If you open the dialog from a revision, it opens in the context of the selected revision. You can specify whether to undo only the specified revision, the specified revision up to another revision, while keeping subsequent changes, or all changes from the selected revision to the head revisionThe most recent revision of a file within the depot. Because file revisions are numbered sequentially, this revision is the highest-numbered revision of that file..
- If you open the dialog from a folder, you need to specify whether to base the operation on a specific revision or changelist or, if you want to undo a range of changes, on a changelist, date/time, or a label.
When undoing a range, the Undo option creates the range according to the limit type:
- For a revision numberA number indicating which revision of the file is being referred to, typically designated with a pound sign (#)., the range goes from the selected revision to the head revision.
- For a selected labelA named list of user-specified file revisions. under a directory selection, the label revision numbers for the various files are checked and undone.
- For a selected changelistA list of files, their version numbers, the changes made to the files, and a description of the changes made. A changelist is the basic unit of versioned work in Helix server. The changes specified in the changelist are not stored in the depot until the changelist is submitted to the depot. See also atomic change transaction and changelist number., the range goes from the changelist number to "now."
- For a selected date/time limit, the range goes from the date/time (in seconds) to "now."
You can preview the undo operation before submitting your changes. You can also specify a revision as the keyword "have." In this case, P4V applies the range for the files under the directory selection according to each file's "have" revision.
When undoing rename or move operations, make sure to perform the undo option on the changelist that includes the rename or move operation. Otherwise, P4V will display an error message. p4 move and p4 rename
operations are atomic in that you cannot split the move/add and move/delete pair.
P4V restores file state as follows:
- Edited files: P4V restores the revision that precedes the one created when the changelist was submitted.
- Deleted files: P4V restores the revision preceding deletion.
- Added files: P4V deletes files that were added by the changelist.
With Helix server 2016.2 and earlier, undoing changes was called rollback or back out and worked as described in Reverse a changelist submission in the P4V User Guide for version 2017.2.
To perform an undo operation:
-
Select one of the following:
- A folder in the Depot or Workspace tree
- A file in the Depot or Workspace tree
- A file revision on the file's History tab
- A submitted changelist on the Submitted tab
-
From the Actions menu, select Undo Changes.
-
In the Undo Changes dialog, if needed, specify whether you want to undo a single change, a range of changes, or all changes from a selected point forward.
- Depending on your selection in step 3, specify a revision, changelist, date/time, or label, or a range of the same.
- Specify whether to check out the changes to a new or existing changelist.
- Optionally, to inspect the file affected by the changes, click Preview.
-
Do one of the following:
- Click Save to Changelist to integrate the changes to be undone into the specified changelist without submitting them just yet.
-
Click Submit to check out the files as specified and immediately submit them. This opens the Submit Changelist dialog box.
By default, the changelist description in the Submit Changelist dialog box displays a comment similar to the following: "Undo <path to file or folder> to revision 3."
Click Submit again to submit the changelist containing the files.
P4V submits the changes.