Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

perforce: sync to an earlier revision

I want to test a fix and to compare the behavior before the fix vs. now; I need to sync to a the earlier version. So, if the fix was committed in revision x; how can I sync to one revision before, say x0?

like image 960
Asad Iqbal Avatar asked Aug 21 '12 01:08

Asad Iqbal


People also ask

What does Perforce sync do?

The Perforce sync command synchronizes your workspace files with the files in the depot. Syncing uses your client spec to determine which depot files to get and where to put them in your workspace. To look at or edit your client spec, click your client name at the top of any screen in P4Web .

What is rollback in P4V?

You can rollback to a point in time based on revision number, changelist number, date, or label. To rollback a file or folder to a previous revision using P4V, context click on the file or folder and select the Rollback menu option.

What does p4 flush do?

p4 flush changes the have list to match whatever you tell it to match (if no arguments, then #head is the default).

How do I stop syncing my p4?

When you are using P4 Windows client, you may cancel a long running sync operation by pressing the red cancel button.


1 Answers

Say that you want to go back to revision 'n' from revison 'n+1' (rollback). You can take the following steps:

  1. p4 sync ...@n

    This will sync your files to the older version that you want

  2. p4 edit ...

    Open all the files for edit or do "p4 edit filename" to open only a particular file for editing.

  3. p4 sync ...@n+1

    Before submiting you need to sync files to the latest revision on the repository.

  4. p4 resolve -ay

    This will accept the changes that you have made, ie, revert all the changes done when you moved from revision 'n' to 'n-1'. So effectively, all your files have been rolled back to revision 'n' in your local repository.

  5. p4 submit ...

    Go ahead and submit the changes. This will roll back all main repository to revision 'n'. Effectively the revisions 'n' and 'n+2'(current) will be identical.

  6. p4 diff2 -q repository@n repository@n+2

    This is just to verify if have rolled back the files. This should show that you have no differing files in the two revisions.

like image 126
Elpis Avatar answered Sep 30 '22 07:09

Elpis