[p4] perforce "svn:externals" equivalent

Chuck Karish chuck.karish at gmail.com
Wed Aug 25 06:44:09 PDT 2010


On Tue, Aug 24, 2010 at 11:31 PM, Johan Nilsson
<r.johan.nilsson at gmail.com> wrote:
> Ilya Kazakevich wrote:
>>
>> Hello,
>>
>> I have several libraries I want to share between my projects. All
>> they are in //myDepo/myLibraries/
>>
>> So, I want to have folder "myLibraries" in my projects. In SVN I
>> could do so using "svn:external" attribute that makes my folder
>> content to be fetched from another folder each time I do "update"
>> ("sync" in perfoce terms).
>>
>> Is it possible to achieve same functionality in perforce?
>
> No, unfortunately. But please tell Perforce Support - they should have an
> enhancement request logged for this which they can add your name to. The
> more the better ...

This restriction has been in the migration FAQ, in response to questions
like "How do I implement VSS shares?", for more than ten years.  Don't
hold your breath.

>> I was
>> thinking about workspace mapping:
>>
>> //myDepo/myProject/...  //myWorkSpace/myProject/...
>>
>> //myDepo/myLibraries/...  //myWorkSpace/myProject/libraries/...
>>
>>
>> But I really do not like this idea because I believe this info should
>> be part of depo, not workspace.
>
> Agreed.

Write a tool that users and scripts can use to generate correct
client views.

>> Additionally I am not sure it will
>> work fine.
>
> It will work.
>
>> So, is it possible to solve it on VCS layer?
>
> I tend to use branching for this purpose, e.g.:
>
> p4 integrate //myDepo/myLibraries/... //myDepo/myProject/myLibraries/...
>
> It is a bit heavier than using workspace mapping (can create quite a bit of
> metadata depending on complexity of "myLibrary") but is easier to maintain,
> IMHO of course. Single-line workspace/client definitions are a Good
> Thing(tm).

This requires recurring work to keep all the instances of the library up
to date.  If many products use the library other problems of scale will
arise; this solution uses a lot of server resources.

> An issue with both of the approaches is that it doesn't protect
> "myLibraries" from getting edited through the target workspace "out of the
> box". As for the latter approach it would be possible to put permissions for
> "integrate only" to paths matching e.g. "//.../readonly-deps/..." and change
> the above integration to:
>
> p4 integrate //myDepo/myLibraries/...
> //myDepo/myProject/readonly-deps/myLibraries/...
>
> I would also recommend you to use versioning in the depot paths, especially
> if you need to maintain separate versions of the libraries/other projects,
> e.g:
>
> p4 integrate //myDepo/myLibraries/REL1.0/...
> //myDepo/myProject/MAIN/readonly-deps/myLibraries/...
>
> Regards,
> Johan

-- 
Chuck Karish   karish at well.com   (650) 283-7864




More information about the perforce-user mailing list