[p4] view code from multiple branches

Ivey, William william_ivey at bmc.com
Mon Aug 3 08:32:34 PDT 2009


Essentially you want a workspace in which you can do a test
integration and see if it builds and works correctly.
Right?

The "sparse branch" thing probably isn't going to do what
you want. For one thing, the itr branch isn't sparse. You
could come up with a way to pick the files with changes 
from itr or main and place them into a test workspace, but
that would not help if files are changed in both itr and 
main. In that case, you would have to do some merging, 
just as if you had integrated them, but without much help 
from Perforce.

If I were trying to do this, but wanted to avoid actually
updating the itr branch, I would create a workspace from
the itr branch, do the integration from main, but not
submit the results. Then I could test the contents of the
workspace to see if there were any problems.

At that point, I'd have the option of submitting it if I
wanted, but I wouldn't have to; I could just revert the
changelist.

Trying to avoid integration is almost certainly going to
lead to a lot more work - most of which will be wasted -
than if the developer just learns how to integrate from
branch to branch and lets Perforce help them sort it out.

-Wm




-----Original Message-----
From: perforce-user-bounces at perforce.com [mailto:perforce-user-bounces at perforce.com] On Behalf Of Kamlesh Mutha
Sent: Monday, August 03, 2009 9:25 AM

Just to clarify, let me correct the typo first:

My requirement is:

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 //depot/main/... branch.

Why is it needed ?

/itr branch is a private branch and developer is working on some
development. While he is working on private branch and main branch is
changing (for the planned development). The developer should be able to see
those changes in a workspace along with his own changes to ensure that both
changes together still build/function fine. Intention is to avoid major
surprise just after integrating private branch in main.

I know, perforce recommends that you keep on rebasing your private branch by
integrating changes from main to private but that involves "integration" and
people sometimes find it pretty difficult. Hence I wanted to check if this
can be handled through some special purpose workspace.

Thanks and Regards,
Kamlesh






On Mon, Aug 3, 2009 at 7:37 PM, Stephen Vance <steve at vance.com> wrote:

> 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
>
>


-- 
Faith waiting in the heart of a seed promises a miracle of life which it can
not prove!
-Ravindranath Tagore
_______________________________________________
perforce-user mailing list  -  perforce-user at perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user




More information about the perforce-user mailing list