What is the difference between "Rollback..." and "Back Out Submitted Changelist #####" in Perforce P4V

Dave Andersen picture Dave Andersen · May 5, 2010 · Viewed 107.1k times · Source

I want to reverse the changes from one of my checkins. In the right-click context menu of the particular changelist, there are these two options:

  • Rollback...
  • Back Out Submitted Changelist

What is the difference between these two? In what situations should I use either one?

Answer

raven picture raven · May 5, 2010

Both of these operations restore a set of files to a previous state and are essentially faster, safer ways of undoing mistakes than using the p4 obliterate command (and you don't need admin access to use them).

In the case of "Rollback...", this could be any number of files, even an entire depot. You can tell it to rollback to a specific revision, changelist, or label. The files are restored to the state they were in at the time of creation of that revision, changelist, or label.

In the case of "Back Out Submitted Changelist #####", the restore operation is restricted to the files that were submitted in changelist #####. Those files are restored to the state they were in before you submitted that changelist, provided no changes have been made to those files since. If subsequent changes have been made to any of those files, Perforce will tell you that those files are now out of date. You will have to sync to the head revision and then resolve the differences. This way you don't inadvertently clobber any changes that you actually want to keep.

Both operations work by essentially submitting old revisions as new revisions. When you perform a "Rollback...", you are restoring the files to the state they were in at a specific point in time, regardless of what has happened to them since. When you perform a "Back out...", you are attempting to undo the changes you made at a specific point in time, while maintaining the changes that have occurred since.