P4 - rollback to previous revision for files in a folder if revision is different for all files

How to rollback to previous revision for files in a folder together if revision of all the files is different using command line? I have a requirement to rollback all the files inside a folder which also contains a sub folder and the revision of all files is not same. All the solutions that i have found requires revision number for the files. So the basic procedure is

To back out changelist 1000:

  1. p4 sync @999
  2. p4 edit //depot/foo.txt //depot/bar.txt //depot/ola.txt
  3. p4 sync
  4. p4 resolve -ay
  5. p4 submit

As found here-

the other option is to use p4 undo command but with this the whole CL is reverted which also reverts changes which are required in my case.

This can be achieved from GUI but what are the steps to achieve the same from command line or the only option is to revert all the files one by one?

1

1 Answer

Use the p4 undo command.

p4 undo folder/...@1000,now

will undo changelist 1000 and all the changelists after it. (This is the equivalent of the steps you posted -- it doesn't only roll back changelist 1000 for those files, because you synced to head in step 3!)

p4 undo @1000,@1000

will undo changelist 1000 by itself.

(This also works with date ranges etc.)

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like