Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an easy way to revert an entire P4 changelist?

Let's say I checked in a changelist (in Perforce) with lots of files and I'd like to revert the entire changelist. Is there an easy way to "revert" the entire changelist in one fell swoop?

Currently I do something like this for each file in the changelist:

  • p4 sync //path/to/file#n (where "n" is the previous version of the file)
  • cp file file#n
  • p4 sync //path/to/file
  • p4 edit //path/to/file
  • cp file#n file
  • rm file#n

As you can imagine, this is quite cumbersome for a large changelist.

like image 768
Marc Novakowski Avatar asked Dec 01 '08 18:12

Marc Novakowski


People also ask

How do I undo a changelist?

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.

How do I undo a p4 revert?

The p4 undo command opens files to undo a set of previously submitted changes. The undone changes remain a part of the file history, but the new revisions submitted after p4 undo reverse their effect. If a single revision is specified, the specified revision is undone.

What is rollback in Perforce?

When you rollback a file or folder, Perforce copies the chosen revision to your workspace and adds the change information to a pending changelist. When you submit the changelist, Perforce persists the chosen revision to the depot as the head revision.

What does clean do in Perforce?

The p4 clean command takes the following actions when finding inconsistencies between files in a user's workspace and corresponding depot files: Files present in the workspace, but missing from the depot are deleted from the workspace. Files present in the depot, but missing from your workspace.


2 Answers

The posted answers provide correct answers, but note also that there is an actual menu option in P4V to do this for you now. It's in the latest 2008.2 Beta, and so should be officially released the the next week or three.

This link gives details.

It should be a lot simpler to use than the earlier answers, but I've not had the opportunity to try it myself yet.

Update This has now been fully released. See Perforce downloads.

like image 80
Greg Whitfield Avatar answered Oct 16 '22 16:10

Greg Whitfield


This looks interesting. I haven't tried it personally.

like image 22
ya23 Avatar answered Oct 16 '22 17:10

ya23