1

Consider the following revisions of a file:

branch                   -1---2---
                        /               
                       /                
main   100--101-102--103---104---

I am currently in my branch and the file is synced to revision 2. I know that p4 has kept the history of the file, because I used merge and not copy, and indeed the history shows revisions previous to 103 (inclusive) when I look at the history of the file and check the option "Follow branch actions".

I would like to roll it back to revision 103 or before. Is this possible?

Answers for p4v preferred, but I'll take command line statements if that's the only way to do it.

butterflyknife
  • 1,438
  • 8
  • 17
  • What do you mean by "roll it back"? Do you just want to get the older version on your laptop, so you can build it and test it, etc.? Or do you want to undo the changes made by revision 2 in your branch, so that other users of your branch will not see that change when they sync the branch? – Bryan Pendleton Mar 02 '18 at 23:07
  • Hi, I just mean to get the older version on my laptop. – butterflyknife Apr 09 '18 at 10:07
  • Then do `p4 sync //path/to/the/file#103` to sync revision 103 to your laptop. In P4V, you can do that by right-clicking on the file and using 'Get Revision' (rather than 'Get Latest Revision'), and filling in the revision 103 in the dialog box. – Bryan Pendleton Apr 09 '18 at 19:23

1 Answers1

2

The copy command is the best way of doing this:

p4 copy main#103 branch

Another option would be to use integ -f:

p4 integ -f main#103 branch
p4 resolve -at

One benefit of copy is that if you're doing this across a bunch of files (e.g. main/...@2018/01/01 to get all of main as of Jan 1) and some of them are already identical to the rev you're copying from because they haven't changed in that time, copy will leave them alone, which makes the result less noisy.

Samwise
  • 68,105
  • 3
  • 30
  • 44