开发者

Branch view for a file that has been split into multiple files

开发者 https://www.devze.com 2022-12-23 18:24 出处:网络
I have a large source file in Perforce that has been split up into several smaller files in a branch. I want to create a branch view that can handle this, but perforce (200开发者_如何学运维9.1) only s

I have a large source file in Perforce that has been split up into several smaller files in a branch. I want to create a branch view that can handle this, but perforce (200开发者_如何学运维9.1) only sees the last of the multiple files. For example, I created:

p4 integrate //depot/original/huge_file.c //depot/new/huge_file.c

Later I split the huge file into smaller ones:

p4 integrate //depot/new/huge_file.c //depot/new/small_file_one.c
p4 integrate //depot/new/huge_file.c //depot/new/small_file_two.c
p4 integrate //depot/new/huge_file.c //depot/new/small_file_three.c

Then edit each of those (including //depot/new/huge_file.c) and submit.

Now I make changes to //depot/original/huge_file.c and I want to integrate those changes to //depot/new. If I do this manually, it works fine:

p4 integrate //depot/original/huge_file.c //depot/new/huge_file.c
p4 integrate //depot/original/huge_file.c //depot/new/small_file_one.c
p4 integrate //depot/original/huge_file.c //depot/new/small_file_two.c
p4 integrate //depot/original/huge_file.c //depot/new/small_file_three.c

But I don't want to do that every time I integrate -- this kind of thing belongs in a branch view.

Unfortunately if the branch view includes the same source file multiple times, the subsequent lines override the earlier ones. How can I create a branch view like this:

//depot/original/huge_file.c //depot/new/huge_file.c
//depot/original/huge_file.c //depot/new/small_file_one.c
//depot/original/huge_file.c //depot/new/small_file_two.c
//depot/original/huge_file.c //depot/new/small_file_three.c

When I integrate using this branch spec, I get only small_file_three.c integrated.


I was going to suggest that you use an overlay mapping (a means to force all the lines of the spec to be processed), but a quick perusal of the page put the kibosh on that:

Overlay mappings are only allowed on client views and do not work with branch views.

It looks like you'll have to script it. This page has some more info that might be of use to you (and emphasizes the fact that this can't be done, "Perforce does not support 1:many file mappings.").


Just as a matter of interest, but why?

Why not have huge_file.c not in Perforce, and then change your build system to assemble it out of the three smaller, source controlled, source files. Or even just #include them if you wanted real simplicity.

In other words, I'm wondering if your're trying to use the wrong tool for the task you want to do?

0

精彩评论

暂无评论...
验证码 换一张
取 消