Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I create a branch in Perforce based on a historic point in time?

I would like to create a branch in Perforce that is based off of some point in the past, i.e. not the current state of the current branch, is this possible? If so, how?

Here is a picture of what I'm trying to do. The current branch is in blue, and the new desired branch is shown in green.

enter image description here

like image 751
jrwagz Avatar asked Feb 21 '14 00:02

jrwagz


People also ask

What is branch mapping in perforce?

The branch mapping is used by the integration process to create and update branches., which specifies the relationship between two codelines. When you branch, you can use the branch mapping instead of a file mapping. Branch mappings are displayed in the right pane on the Branch Mapping tab.

What is perforce integrate?

The Perforce integrate command branches new files from existing files and propagates changes between branched files. You can also use integrate to effectively rename files by branching new ones from existing ones and deleting the existing ones.


1 Answers

This will do it:

p4 copy //depot/project/dev/...@release_x_label //depot/project/release_x/...

The command tells Perforce to copy //depot/project/dev/... as of release_x_label to //depot/project/release_x/... You can run this command entirely server side using p4 copy -v. If you don't need a copy of the files locally it's much quicker.

You can do it in one go without needing a submit by using p4 populate

p4 populate //depot/project/dev/...@release_x_label //depot/project/release_x/...

I usually use copy though to make sure I don't have any typos. =)

You can do all of this with streams as well. It's a bit odd in that the revision specifier that you use to choose what to branch from gets put on the target path you're branching to.

p4 populate -rs //stream/dev2 //stream/dev2/...@1

This will populate dev2 from its parent as of changelist1.

like image 173
Matt Avatar answered Nov 15 '22 07:11

Matt