In git, when you run git checkout -b <name> while on branch A, assuming you had no pending changes, a new branch will be created and your workspace will switch to it. No files will be modified or copied, new branch will match branch A exactly.
I want to do the same with P4. I have a stream trunk which has about 2.5TB of data in it, currently sitting on changelist 584 as the latest changelist. I want to create a new stream called zero-four where its initial state will look exactly the same as the state of the trunk at changelist 584. Basically P4 checkout -b zero-four.
The official way to do it is to create a new empty stream, COPY all the data you want in the initial changelist and submit it. You can see how that could be a pain when the branch you're working with has 2.5TB of data.
The way I currently plan to do it is to simply MOVE trunk into zero-four, submit zero-four, and then just move it back. I don't need to switch to zero-four, in this case, I actually don't want to.
Is there a saner way to do this? A command that will initialize a stream based on a state of another stream?
I think the command you are looking for is p4 populate
In this case, you would create the stream and then you would run
p4 populateto replicate all the files into the new stream, without needing to sync them locally and copy. If you are doing this in P4V, you can just check the box at the bottom of the stream creation dialog that says "Branch files from parent on stream creation"Hope that helps!