Anand
Anand

Reputation: 1122

Perforce: restoring a branch to an old changelist and then restoring it to the current state

I want to restore my branch to a given changelist to generate certain executables and then restore it back to the original state. An example will make this clear.

Currently the last changelist that went into main is @108. I want main restored to changelist @100. So if anyone syncs, they will see the changes upto @100. So the Engineering team can generate the executables out of @100 by just doing a p4 sync.

I have to do this since the engineering team won't do:

% p4 sync @100

due to process requirements.

Once this is done, I need to restore all the changelists from @101 to @108by the end of the day so that the nightly builds don't get affected.

Is there a graphical way using p4v to do this? If there are pointers to command line options it would be helpful too.

Upvotes: 1

Views: 562

Answers (2)

Samwise
Samwise

Reputation: 71424

As Mike said, doing "Rollback..." in P4V should let you reset everything to a particular changelist.

I'll chip in the command line version as well. From the "main" root directory:

p4 copy ...@100 ...
p4 submit

This is a slightly atypical use of "p4 copy", but it turns out that just copying an old version of a directory on top of itself is a very effective and clean way of rolling back. You can use the "-v" option on "p4 copy" to skip having to sync everything to your workspace.

Upvotes: 2

Mike O'Connor
Mike O'Connor

Reputation: 3803

If you right click on a folder in P4V, you can choose "Rollback..." and pick 100 as the changelist you want to roll back to.

Then at the end of the day, you would repeat that process and pick 108.

That should leave everything as it was at the beginning of the day. It should work fine as long as no one will be checking in during this process.

Upvotes: 2

Related Questions