[p4] view code from multiple branches

Stephen Vance steve at vance.com
Mon Aug 3 07:07:11 PDT 2009


You may want to look at Sandy Currier's p5 tools to support sparse 
branches. I think you can get them from his web site at releng.com. It 
can be done manually, as well, but it's not the most natural workflow in 
Perforce.

What is your motivation for wanting sparse branches?

Generally, the reasons for wanting sparse branches in Perforce are a) 
wanting a workflow similar to that of another SCM system, b) avoidance 
of merging, or c) a large code base with a large user community and an 
aggressive branching model.

For a), you just need to recognize that different SCM systems do things 
different ways and most of them are correct and consistent models, but 
few of them support all workflows. Changing tools often requires 
changing workflows. The Perforce model is full branching and the 
overhead for a branch is pretty light. Unless you fall in to the 
category described in (c), don't fight the tool.

For b), I can only say that Perforce has excellent merging support and 
that you will create more problems trying to avoid merging than you 
would save. Define a planned branch strategy rather than letting it 
happen in an uncontrolled manner and make sure people have the right 
training.

For c), you may need to make some extra efforts to keep your db sizes in 
check. Tools like the p5 tool set and planning for product and project 
componentization to facilitate more local branching will take you a long 
way. Very few organizations fall into this category, however.

Steve

Kamlesh Mutha wrote:
> Hi All,
>
> Can someone please let me know if the following is possible in perforce and
> how?
>
> 1. I have a branch //depot/main/...
> 2. I fork off a new branch //depot/itr/... from //depot/main
> 3. I want to have a workspace in which I should be able to see following
> files
>                 a. All files modified on //depot/itr branch
>                 b. For a file which is not modified on //depot/itr/..., the
> latest revision from //ars/main/... branch.
>
> Thanks,
> Kamlesh.
>
>
>   

-- 
Stephen Vance
www.vance.com



More information about the perforce-user mailing list