CVS handling shared files

Derek Neighbors plug-devel@lists.PLUG.phoenix.az.us
Fri Jul 12 16:50:02 2002


On Fri, 12 Jul 2002, Alan Dayley wrote:

> I am confused about how to handle this CVS situation.  We have a group of 
> projects, like 24 or something, that vary mostly in the build options and 
> share almost all the same source code files.  For example:
> 
> Projects FOO, BAR, BOGUS and ROGER all use file SRC1.C.
> 
> How do I checkout SRC1.C to make changes for project FOO but have the 
> changes in the file also show up in the other 3 projects after I have 
> committed the changes?

Honestly, the right answer is if more than one product uses something it 
really should be a library not the same code over and over.  (i.e. code 
reuse should be used not code cut and paste) ;)

However, I have been there and realize you making things right, might not 
be an immediate option. The right answer is use symlinks of the file 
system on the CVS repository.  Luckily your organization isnt the only one 
that has done a no no and needed a solution to remedy it. :)

Basically you would create the file in one of the projects.  Then create 
symlinks (instead of real files) for all the other projects that use it.  
Then you can check out/commit from any project and all other projects are 
immediately updated.

Hopefully that answers the question.

-Derek