R – Perforce branching from a Perforce branch

perforceversion control

A path in Perforce contains files a.txt and b.txt. I'll refer to the main path as mainline.

I've create a branch (called initialbranch) from there which contains just a.txt. I make lots of changes to a.txt, and am very happy with it. However, it's not yet ready for submitting back to mainline. I can easily integrate any changes to a.txt that occur in mainline.

Another project comes along, which needs the changes from initialbranch. Now, say I want to make changes to b.txt, and want to be able to integrate changes that happen both in initialbranch and in mainline. At present, I'm branching from initialbranch (call this new branch secondbranch). Previously I've been adding b.txt to initialbranch, and then integrating my changes across to secondbranch. Is there a nicer way to do this?

Sorry if this question seems somewhat convoluted, I've expressed it as best I can!

Thanks,

Dom

Best Answer

I'm not convinced I understand your question, but I'll try to help.

If you're saying that you don't really want b.txt in initialbranch, you can define a branch specification like this:

initialbranch/a.txt secondbranch/a.txt
mainline/b.txt secondbranch/b.txt

That way, when you integrate using the "secondbranch" branch spec, your changes in secondbranch will get pushed to initialbranch or mainline.

If you don't want to push changes directly from secondbranch to mainline, then do what it sounds like you are already doing: integrate b.txt from mainline to initialbranch, then from initialbranch to secondbranch. Work on it in secondbranch, then integrate the changes successively back to initialbranch and mainline.